helloSystem / Utilities

Utilities written in PyQt5, meant for use with helloSystem
BSD 2-Clause "Simplified" License
28 stars 29 forks source link

Replace arandr with something in PyQt #41

Open grahamperrin opened 3 years ago

grahamperrin commented 3 years ago

0.4.0 (0D25)

I didn't make a screen recording, but it was (repeatedly) difficult to use drag-and-drop.

drag and drop difficulties

More often than not, I simply could not move a screen from left to right, or vice versa.

probonopd commented 3 years ago

Looking for a (Py)Qt based replacement for arandr.

grahamperrin commented 3 years ago

I don't know whether it's Py, but the Monitor Configuration utility within x11/lumina-coreutils is probably Qt-based:

image

https://www.freshports.org/x11/lumina-coreutils/#dependencies

% which lumina-xconfig
/usr/local/bin/lumina-xconfig
% file /usr/local/bin/lumina-xconfig
/usr/local/bin/lumina-xconfig: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400001), FreeBSD-style, stripped
% pkg which /usr/local/bin/lumina-xconfig
/usr/local/bin/lumina-xconfig was installed by package lumina-coreutils-1.6.0
% strings /usr/local/bin/lumina-xconfig | grep qt5
/usr/local/lib/qt5
% 

https://github.com/lumina-desktop/lumina/tree/master/src-qt5/core-utils/lumina-xconfig

NB from https://github.com/lumina-desktop/lumina/tree/master/src-qt5/core-utils:

… It is strongly-encouraged that the "core-utils" of Lumina are built and distributed as a single package. …

probonopd commented 3 years ago

Possibly we can write some PyQt around https://raw.githubusercontent.com/python-xlib/python-xlib/master/examples/xrandr.py

PreyK commented 3 years ago

Possibly we can write some PyQt around https://raw.githubusercontent.com/python-xlib/python-xlib/master/examples/xrandr.py

Looked into python-xlib and pyqt. python-xlib is more like a Python Xlib implelentation than an arandr one. python-xlib wants to control the window explicitly trough X as far as I looked into it, not sure how well it would play with Qt. It probably Can work but I'v found an other project witch is much simpler and would be pretty easy to implement something like this with. https://github.com/cakturk/pyrandr It's last commit was 3 years ago but it's really not that big of a lib, it's like 300 lines of python, probably can use it as a starting point and rework if needed(?)

I'd love to work on this! The only question is how graphic would it be? :D I had an idea and made a quick prototype with QtDesigner displays

Or I can just make a really simple one without icons and stuff, more like arandr but in PyQt.

probonopd commented 3 years ago

@PreyK that would be awesome.

Maybe also check out the code for Ubuntu's Displays tool image

What I like about it is that it shows the displays with their relative size.

In Ubuntu, those settings are saved in the home directory, not system-wide: ~/.config/monitors.xml. Does this mean it works without root?

PreyK commented 3 years ago

@PreyK that would be awesome. What I like about it is that it shows the displays with their relative size.

Yes! relative size is a must, I already have it working! Not sure about the fancy images and looks tho, maybe it would make more sense to have something that just works and easily hackable. The whole reason for PyQt as far as i can tell is to make it simple to look at and take apart. This case it would be a plus if the user doesn't have to worry about maybe hundreds of lines of pyqt responsive svg rendering, qt layouts and separate .ui files etc.. (But again it'd look so nice xd) Not sure about how ubuntu does it, always stayed away from ubuntu based distros, there's only problems with them. Mainly used SUSE and Solus. It shouldn't require root tho. My current implementation essentially uses a pyhton/pyQt wrapper around the xrandr cli so it should work without root. Planning to look into saving and restoring the display layout once i have something that has feature parity with ARandR. This is how it looks currently (zero considerations to design, purely just a functional proto) but i still need it do do some more things (display mirroring, on/off, maybe refresh rate and colorspace etc.. proper display names would be nice too not just "DP-1 or HDMI-2", can get the EDID from xrandr that should have it, need to get a parser, handle invalid/broken EDID-s as some manufacturers don't really care about VESA standards etc..) But yeah, I think it's a progress :D image

probonopd commented 3 years ago

That looks great @PreyK! Can't wait :+1:

PreyK commented 3 years ago

Got EDID to kind of work! Does anyone by any chance know a database where I can look up proper/updated manufacturer names? Using a db (60kb .csv) from https://uefi.org/pnp_id_list It returns string like SAM-> Samsung Electric Company TSB-> Toshiba America Info Systems Inc DLL-> Dell Inc Wich is good enough, I can just use the first part of the manufacturer name to display the maker Except there are some weird ones like LG wich is GSM-> Goldstar (Manufacturing) Company Ltd, using the first part would just show Goldstar instead of LG They used to be Goldstar, became LG but still putting goldstar into their EDID even tough their manufacturing label says LG since the 2000's Or AUS-> ASUSTek Computer Inc LG It's not that big of a deal to adjust the major ones (like LG, ASUS etc..) in the csv for lookup, but if anyone has something that's more up to date or maybe community maintained let me know :D The goal would be to show the connected display's info instead of just "DP-X" something like this: image

probonopd commented 3 years ago

https://www.lansweeper.com/knowledgebase/list-of-3-letter-monitor-manufacturer-codes/

Seems incomplete though. "PEB" (as on the Ubuntu screenshot above) is nowhere to be found.

probonopd commented 3 years ago

Some more: https://github.com/sewar/edid.tv/blob/master/frontend/sql/manufacturer.sql

"PEB" still missing

probonopd commented 3 years ago

Possibly this is the original source: https://uefi.org/pnp_id_list These seem to be "UEFI PNP" vendor IDs, not limited to displays/TVs/monitors.

Download full list as Excel Sheet: https://uefi.org/uefi-pnp-export

"PEB" also missing there, though.

PreyK commented 3 years ago

Thanks! WIll look into thoose

Is it possible PEB is something custom? Haven't found anything on it except display boards/adapters https://develop.phytec.com/hardware-accessories/raspberry-pi-hat-prototype-board-peb-proto https://develop.phytec.com/hardware-accessories/av-adapter-peb-av-02 https://www.aliexpress.com/item/33006671931.html Possibly a rapsberry PI/embeded display?

probonopd commented 3 years ago

I don't know. Just saw it on that Ubuntu screenshot which I had googled as an example.

Here is one more such database, this time specifically for EDID: https://edid.tv/manufacturer/

PreyK commented 3 years ago

Here is one more such database, this time specifically for EDID: https://edid.tv/manufacturer/

I think I started with that. Unfortunetly GSM still looks up to Goldstar instead of LG. (And there's no LG) I mean technically they aren't wrong it's just that the display's name is not that Will probalby just make my own CSV with a few edits so the user would see their proper manufacturer + model number

probonopd commented 3 years ago

You don't want to just use the first word, do you? What about e.g., Bang & Olufsen?

PreyK commented 3 years ago

Nope 😃 Ideally i want to show the Manufacturer+model number (in a way that's printed on the box at least for the most popular display manufacturers) so if the user has like 2 displays from Samsung they know exactly wich one is wich. Also there's a lot of displays with labels under the VESA mount and boxes already thrown away, it might help someone.

Oh, Bang & Olufsen makes displays... image

probonopd commented 3 years ago

Every "TV" manufacturer makes "displays" these days ;-)

probonopd commented 2 years ago

Hello @PreyK are you still looking into this?

PreyK commented 2 years ago

Hello @PreyK are you still looking into this?

I'd love to, unfortunately, haven't had the time recently to make big changes. Uploaded everything I have currently to a repo https://github.com/PreyK/HelloDisplay I plan to continue on this as I have time but it'll be pretty limited in the near future :/

probonopd commented 2 years ago

Thank you @PreyK - it looks like a promising start!

probonopd commented 2 years ago

I have put it into the "Under Construction" folder on the ISO in the hope that people will see and contribute to it. Again, thanks a lot @PreyK.