You are not logged in.

#1 2024-02-01 17:22:45

iith4ahm
Member
Registered: 2021-01-11
Posts: 53

tiling window manager w/ shared tags and layout spanning all monitors

I want to have a top bar with labeled tags/activities/workspaces such as "to-do list", "coding", "music", "blank/just look at wallapaper", "email and chat", and so on. Whichever workspace I'm currently on will automatically distribute/tile my windows across all monitors. Then when I click on a new workspace it changes which workspace I have for *all monitors at once*.

(this may be a feature desired more by people with small monitors where you very very quickly run out of room when you start tiling)

Does anyone know of a tiling window manager like this? Thanks

Related links that may aid in understanding what I'm talking about and raise awareness to window manager developers:

https://bbs.archlinux.org/viewtopic.php?id=257719
https://www.reddit.com/r/xmonad/comment … _monitors/
https://www.reddit.com/r/suckless/comme … p_share_a/
https://www.reddit.com/r/suckless/comme … _monitors/
https://dwm.suckless.org/patches/single_tagset/
https://bbs.archlinux.org/viewtopic.php?id=216772
https://www.reddit.com/r/bspwm/comments … ce_across/
https://www.reddit.com/r/swaywm/comment … 2_screens/
https://superuser.com/questions/192271/ … -workspace
https://superuser.com/questions/556877/ … itor-setup
https://unix.stackexchange.com/question … le-binding
https://www.reddit.com/r/i3wm/comments/ … orkspaces/
https://www.reddit.com/r/bspwm/comments … _monitors/
https://www.reddit.com/r/swaywm/comment … _monitors/
https://superuser.com/questions/495570/ … -workspace
https://www.reddit.com/r/linuxquestions … itieslike/

Offline

#2 2024-02-07 21:26:43

basshelal
Member
Registered: 2024-02-07
Posts: 2

Re: tiling window manager w/ shared tags and layout spanning all monitors

It's extremely surprising that this is not at least an option on popular tiling window managers and there aren't more people asking for it.
I switched from PopOS's tiling which is built on top of GNOME where a "workspace" spanned multiple monitors, going to workspace 2 meant all monitors changed their contents.
I swapped between a few popular tiling window managers to find or hack this together but nothing was easy, in the end I just built this functionality myself in Qtile.
Python and Qtile are quite flexible so you can do a lot if you know some basic programming, Qtile's documentation is quite good, but you'll need to access internal fields and members from qtile's classes in order to get more power, this stuff isn't shown in the documentation.
Stumpwm claims to work in this way, but good luck with Lisp and the documentation looks poor, which is very important when you're going to be building stuff yourself.
You can do this in awesomewm, in fact it might work better in awesomewm (awesomewm is extremely powerful) but the documentation there is not the best so you will struggle a lot, though I find Lua is simpler than Python and awesomewm's defaults are very sensible and easy for those migrating from floating window managers.

What I did in Qtile is tell it I have 15 workspaces (or groups in Qtile terms), 5 for each monitor, L1, L2, L3, L4, L5 all on the left monitor, C1, C2, C3, C4, C5 all on the center monitor, R1, R2, R3, R4, R5 all on the right monitor, these are fixed to those monitors.
You then have to change ALL group switching functionality, for example when you switch to group 1 you have to focus groups L1, then C1, then R1. To move a window to group 1 you have to determine which screen it's on then move it to that group, so if it's on the left screen in group 4 and I want to move it to group 2 I have to tell Qtile to move it to group L2.
It's ugly, and worst of all any applications that try to do stuff based on your workspaces like rofi or polybar or wmctrl will show all 15 workspaces and break all your custom functionality, so you can't reliably use those applications unfortunately, though you can probably just hack on those to make it work. Qtile supports user hooks to you can tell those applications to send a certain message to qtile and then program the response accordingly, I haven't done this yet but may do it in the future.

I'm still hacking at my qtile config to make it a little better but I'll upload it to Github when I get it looking cleaner and figuring some more things out.

I hope this helped.

Offline

#3 2024-02-08 03:20:08

iith4ahm
Member
Registered: 2021-01-11
Posts: 53

Re: tiling window manager w/ shared tags and layout spanning all monitors

Thanks for registering to post.

i saw something like that. a lot of hacking. do you have it so it redistributes the windows between monitors automatically?

I wonder how much work it would be (and how welcome contributions would be) to modify the source of one of the existing window managers to add the functionality first-class. perhaps if a developer comes across this they could chime in.

I didn't know about stumpwm. A quick glance doesn't suggest mouse friendliness. Do window-manager-agnostic clickable bars exist for switching workspaces that could be combined with it?

Offline

#4 2024-02-11 23:22:48

basshelal
Member
Registered: 2024-02-07
Posts: 2

Re: tiling window manager w/ shared tags and layout spanning all monitors

Ah you noticed I registered to post! Yeah I saw your post around the same time I began experimenting so I thought if I solved it I will go back and document my experience.

I'm not sure I understand what you mean. If you mean the monitors, I have the monitors hardcoded, I'm on a desktop and never change monitor setup so that works for me. Making it automatically work for changing monitor setups should be doable but I can't even predict how difficult that would be, leading me to think it could be very difficult.

If you mean the windows themselves, no each monitor uses Qtile's bsp layout (the one I liked the most) and I have some relatively simple custom code to move windows across to the neighboring monitor when it's on the edge of the current monitor. So if the current window is on the right edge of the center monitor, a move right action will move it to the right monitor, a move left action will move it left inside the center monitor. If the current window is on the right edge of the right monitor then a move right will do nothing, if it's on the left edge of the right monitor, then a move left will move it to the center monitor etc.

Qtile's maintainer didn't want to implement this internally but mostly because it can be hacked together.

Honestly, I think our best bet is to just hack it together, but the only difference will be how optimally we hack it, I do recommend Qtile though because the possibilities are very powerful while having good documentation and simple enough source and language to go through with it with enough time and dedication (not too much I think).

The only other alternative is of course going full neckbeard and building your own version of Qtile which *does* implement this internally but that seems like even more effort than hacking it together.

See Qtile's github discussions for more ideas and possible solutions to this.

polybar is window manager agnostic and provides clicking (and scrolling) functionality where you can theoretically implement workspace switching, but I never bothered with it, I just made it display the current workspace and was happy with that for the time being.

Sorry for the late response.

Offline

#5 2024-02-13 21:59:52

iith4ahm
Member
Registered: 2021-01-11
Posts: 53

Re: tiling window manager w/ shared tags and layout spanning all monitors

basshelal wrote:

Qtile's maintainer didn't want to implement this internally but mostly because it can be hacked together.

Honestly, I think our best bet is to just hack it together, but the only difference will be how optimally we hack it, I do recommend Qtile though because the possibilities are very powerful while having good documentation and simple enough source and language to go through with it with enough time and dedication (not too much I think).

hm. maybe so for now..
but then it's another thing to maintain...
or honestly maybe i'll just get a bigger monitor. 1280 x 1024 is just too small.
but if you've already started writing it...
also im using awesomewm. not married to it, but i do like how you can move windows with the mouse and it snaps them to tile.

iith4ahm wrote:

do you have it so it redistributes the windows between monitors automatically?

basshelal wrote:

I'm not sure I understand what you mean.

so when you open or close a new window, it automatically rebalances your windows across all monitors, instead of having to manually pick where each window goes, and continually readjust. sounds like you don't. something like here:

# the first dimension of the list corresponds to the number of monitors available

# the second dimension (the rows) corresponds to the number of windows open
# if there are 0 windows use row 0
# if there is 1 window use row 1
# if there are 6 windows use row 6

# the third dimension corresponds to individual monitors.
# for each monitor a list of the windows that should appear on that monitor is
# given in layout order
# window 0 is the newest window



# tile the oldest windows first until we have 4 windows on a monitor
# then once the monitors start filling up, start tiling more monitors
# until all monitors are tiled (only have entries for 7 windows here - 
# add more rows to handle more windows)
tile_old_first = [

    # this is the case where there are no monitors at all
    # included to make indexing pretty
   [[],
    [],
    [],
    [],
    [],
    [],
    [],
    []],

    # this case is where there is just one monitor so it's not interesting either
   [[   [],             ],
    [   [0],            ],
    [   [0,1],          ],
    [   [0,1,2],        ],
    [   [0,1,2,3],      ],
    [   [0,1,2,3,4],    ], # if we wanted to hide window 4, just don't add to list.
    [   [0,1,2,3,4,5],  ], # to limit to most recent 4 windows, don't add 4 or 5 to list
    [   [0,1,2,3,4,5,6] ]],

    # this is for a 2-monitor setup
   [[   [],         [],         ],
    [   [0],        [],         ],
    [   [0],        [1],        ],
    [   [0],        [1,2],      ],
    [   [0],        [1,2,3],    ],
    [   [0],        [1,2,3,4],  ],
    [   [0,1],      [2,3,4,5],  ],  # the second monitor takes the last 4 windows, leaving the first monitor with the most recent 2
    [   [0,1,2],    [3,4,5,6],  ]],

    # finally a 3-monitor setup
   [[   [],         [],         []          ],  # no windows open
    [   [0],        [],         []          ],  # one window open
    [   [0],        [1],        []          ],  # two windows open
    [   [0],        [1],        [2]         ],  # etc
    [   [0],        [1],        [2,3]       ],
    [   [0],        [1],        [2,3,4]     ],
    [   [0],        [1],        [2,3,4,5]   ],  
    [   [0],        [1,2],      [3,4,5,6]   ]
    ]
]

# an alternative multi-monitor auto arrangement
# tile all monitors so they have about the same amount of windows
tile_evenly =  [
   [[],
    [],
    [],
    [],
    [],
    [],
    [],
    []],
   [[   [],             ],
    [   [0],            ],
    [   [0,1],          ],
    [   [0,1,2],        ],
    [   [0,1,2,3],      ],
    [   [0,1,2,3,4],    ],
    [   [0,1,2,3,4,5],  ],  
    [   [0,1,2,3,4,5,6] ]
    ],
   [[   [],         [],         ],
    [   [0],        [],         ],
    [   [0],        [1],        ],
    [   [0],        [1,2],      ],
    [   [0,1],      [2,3],      ],
    [   [0,1],      [2,3,4],    ],
    [   [0,1,2],    [3,4,5],    ],  
    [   [0,1,2],    [3,4,5,6],  ]
    ],
   [[   [],         [],         []          ],
    [   [0],        [],         []          ],
    [   [0],        [1],        []          ],
    [   [0],        [1],        [2]         ],
    [   [0],        [1],        [2,3]       ],
    [   [0],        [1,2],      [3,4]       ],
    [   [0,1],      [2,3],      [4,5]       ],  
    [   [0,1],      [2,3],      [4,5,6]     ]]
]

# another alternative
# start tiling in the first monitor. when we have it fully tiled with 4 windows
# then move all 4 windows to the second monitor and start tiling new windows on the first monitor
tile_right_away = [
   [[],
    [],
    [],
    [],
    [],
    [],
    [],
    []],
   [[   [],             ],
    [   [0],            ],
    [   [0,1],          ],
    [   [0,1,2],        ],
    [   [0,1,2,3],      ],
    [   [0,1,2,3,4],    ],
    [   [0,1,2,3,4,5],  ],  
    [   [0,1,2,3,4,5,6] ]
    ],
   [[   [],         [],         ],
    [   [0],        [],         ],
    [   [0,1],      [],         ],
    [   [0,1,2],    [],         ],
    [   [0,1,2,3],  [],         ],
    [   [0],        [1,2,3,4],  ],
    [   [0,1],      [2,3,4,5],  ],  
    [   [0,1,2],    [3,4,5,6],  ]
    ],
   [[   [],         [],         []          ],
    [   [0],        [],         []          ],
    [   [0,1],      [],         []          ],
    [   [0,1,2],    [],         []          ],
    [   [0,1,2,3],  [],         []          ],
    [   [0],        [1,2,3,4],  []          ],
    [   [0,1],      [2,3,4,5],  []          ],  
    [   [0,1,2],    [3,4,5,6],  []          ]]
]


user_multi_monitor_arrangement = tile_evenly



# perhaps there would be default functions like these below
# user could redefine these functions and use programmatic logic
# rather than nested lists if they prefer



# as default this function will just select the appropriate data
# from the nested lists above
# depending on the number of monitors and windows available
def monitor_arrangement(monitors,windows):
    arrangement = dict()
    for i,m in enumerate(monitors):
        arrangement[m]=user_multi_monitor_arrangement[len(monitors)][len(windows)][i]
    return arrangement

# call whenever a window is opened or closed
def reshuffle(monitors,windows):
    arrangement = monitor_arrangement(monitors,windows)
    for m in monitors:
        for j in arrangement[m]:
            windows[j].move_to_window(m)
basshelal wrote:

polybar is window manager agnostic and provides clicking (and scrolling) functionality where you can theoretically implement workspace switching, but I never bothered with it, I just made it display the current workspace and was happy with that for the time being.

ok thanks that is interesting. the idea of having a bar independent from the wm seems handy in its own right, as that's where a lot of the config happens so if you want to switch wms you have less to reconfigure. i saw a youtube video where he makes workspaces clickable by using xdotool to simulate key presses to change workspaces. seems like a very cross-window-manager way to do it - just readjust polybar and/or the window manager to match up with workspace switching keybindings. i don't think it highlighted the current workspace but maybe that's possible too.

Last edited by iith4ahm (2024-02-13 22:01:52)

Offline

Board footer

Powered by FluxBB