On Sat, Apr 08, 2023 at 07:09:54PM +0200, Maxime Soulé wrote: > > Le 08/04/2023 à 18:03, Quentin Barnes a écrit : [...] > > 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. Thank you!
> > 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. How does xrandr take care of that? Does it have naming device requirements that preclude digit only naming? The names have always been prefixed with an alpha characters and not a simple digit string as far as I know, but I didn't know if that was just a convention or a requirement. > > 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? Sure! I can provide the examples of what I had previously mentioned. The examples below are copied from my current ".ctwmrc". These are places in the file where I had been using "WIDTH" and "HEIGHT" to determine relative sizing for the screen, but they would make my WorkSpace and IconManager gigantic on my laptop's LCD screen whenever connecting an external monitor or two. I've now replaced them with "MONITOR_0_WIDTH" and "MONITOR_0_HEIGHT", so the WorkSpace and IconManager look normal again in their original size regardless of whether an external monitor is connected or not: ============== define(BORDER_WIDTH,2) define(WORKSPACEMGR_ROWS,2) define(WORKSPACEMGR_COLUMNS,3) define(WORKSPACEMGR_WIDTH,eval(MONITOR_0_WIDTH/7)) define(WORKSPACEMGR_HEIGHT,eval(MONITOR_0_HEIGHT/7)) define(WORKSPACEMGR_X, ifelse(LEFT,1,+0,+eval(WIDTH-WORKSPACEMGR_WIDTH-BORDER_WIDTH))) define(WORKSPACEMGR_Y, ifelse(TOP,1,+0,+eval(HEIGHT-WORKSPACEMGR_HEIGHT-BORDER_WIDTH*2))) define(WORKSPACEMGR_GEOMETRY, WORKSPACEMGR_WIDTH`'x`'WORKSPACEMGR_HEIGHT`'WORKSPACEMGR_X`'WORKSPACEMGR_Y) define(ICONMGR_COLUMNS,4) define(ICONMGR_WIDTH,eval(MONITOR_0_WIDTH/4)) define(ICONMGR_HEIGHT,eval(MONITOR_0_HEIGHT/20)) define(ICONMGR_X,ifelse(LEFT,1, +eval(WORKSPACEMGR_X+WORKSPACEMGR_WIDTH+BORDER_WIDTH), +eval(WORKSPACEMGR_X-ICONMGR_WIDTH-BORDER_WIDTH*2))) define(ICONMGR_Y,WORKSPACEMGR_Y) define(ICONMGR_GEOMETRY,ICONMGR_WIDTH`'x`'ICONMGR_HEIGHT`'ICONMGR_X`'ICONMGR_Y) IconManagerGeometry "ICONMGR_GEOMETRY" ICONMGR_COLUMNS WorkSpaceManagerGeometry "WORKSPACEMGR_GEOMETRY" WORKSPACEMGR_COLUMNS ============== I came up with the macros above to handle switching between monitors of differing resolutions. The approach worked great until I had multiple monitors. Another use case is with the new xrandr feature, I wanted to assign certain windows to certain screens, but that had me hardcoding the primary monitor name which can change. Now I can use "MONITOR_0" to avoid hardcoding: ============== WindowGeometries { "OpenSSH" "MONITOR_0:+0+0" "Xsession" "MONITOR_0:+0+0" } ============== I share my ".ctwmrc" between my laptop and three other desktop systems. They all like their own primary screen names and screen sizes. I have plans to use the MONITOR_<n>_WIDTH for telling relative sizes on the screen between the monitors for placing some windows on startup (or when they open), but I haven't done that math yet. I also have plans for MONITOR_<n>_X and MONITOR_<n>_Y for telling how the screens are situated relative to one another. More math though I need to do before I can use the new macros. If there's a better way than using pixel-based math for sizing and placement via geometry, let me know. There's a good chance I've missed newer features of ctwm that I'm not taking advantage of. > > (BTW, I've been using ctwm as my primary and daily X11 window > > manager since its first release 30 years ago.) > > > > Same here :) I was originally on mwm circa 1990 and didn't like it at all, so I switched to twm then tvtwm. I used tvtwm, but wasn't happy with its room size != screen size and how windows would "intrude" across different virtual rooms. As soon as ctwm was available with its isolated workspaces and phys == virt, I realized that was the best answer by far, so I stayed. :) > ++ > > Max. >