Re: RFC: ctwm enhancement for multiple monitors
Maxime Soulé <[email protected]> Sat, 8 Apr 2023 19:09:54 +0200
| Newsgroups | gmane.comp.window-managers.ctwm |
|---|---|
| Message-ID | <[email protected]> |
Le 08/04/2023 à 18:03, Quentin Barnes a écrit : > > I'm happy to see the recent ctwm changes with xrandr support! > > To take better advantage of those changes, I'd like some info about > the monitors to be available when processing my ".ctwmrc" file. > > I tried hacking what I could via esyscmd()s that would route the > output of the xrandr command through awk to squeeze out what I > needed, but that was clumsy and rather painful at best. Then I > thought that maybe I could just mod ctwm itself to provide that info > via m4 macros, so I went a hacking. > > So far those mods have been working out fine for me, and I'd like > to see if anyone has any comments on them. > > My problem is I have a laptop that at any given time may be > connected to 0-2 external monitors which may use different graphical > dongles of varying resolutions (anything from 1024x768 to 4K) > depending on the site, meeting room, dock, etc. > > What I was missing the most are two things: the resolutions of the > various monitors so that I could do some scaling in my ".ctwmrc", > and the names of the monitors so I could specify them in the xrandr > extended geometries. Since the resolutions and names change often > for me, I can't just hardcode them. > > I created a commit with my changes for comment here: > https://github.com/qbarnes/ctwm-mirror/commit/aa2148e20b5ef117c2d501fda5c07b4e3f96c610 > (If you try out the change yourself, be sure to pick up the earlier > commit 1240941 that adds the function RLayoutGetNameIndex().) Hi, Good idea, I just commented your last commit. > > In the macro that is "MONITOR__<name>", it's got the double-underbar > to prevent a possible name collision with "MONITOR_<number>". If > there is absolutely no chance a device ever being a simple integer > now or in the future, then the extra underbar can be removed. I think there is no chance a collision occurs, as Xrandr should take care of this. > > All the new macros are simple except for "MONITOR__<name>". Because > device names can have some special characters, I'd recommend to > always use indir() when expanding it. > > I have a question about the order of devices returned by xrandr. > I didn't know if it can be assumed that first listed device will > _always_ be the primary device. It seems that way, but I didn't > know if that was guaranteed. Does anyone know? > > What do people think of this change overall? Was what it something > that makes sense and might be useful to others? Is there a better > or different way to do what I need to do instead? Out of curiosity, do you have some examples of use of these new macros? > > (BTW, I've been using ctwm as my primary and daily X11 window > manager since its first release 30 years ago.) > Same here :) ++ Max.