Feature request: allow windows from the same group to be present on multiple screens (i.e.allow groups to span screens) #3035
-
This requires groups not to be bound to a particular screen. This would open up a workflow where switching groups would update windows on all monitors, allowing rapid context-switching. As an example, I want group A to contain windows A1, A2, A3, and A4, with A1 and A2 on monitor M1 and A3 and A4 to be on monitor M2. When I switch to group B, I want B1 and B2 on monitor M1 and B3 and B4 on monitor M2. This could be added as an optional parameter when creating the group so that users can choose whether the group should be bound to one screen at a time or not. While I could combine multiple physical monitors into a single screen using xorg, that would mess up tiling boundaries and would depend too strongly on the physical layout of the monitors. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
What you could do is write a function that means when you open group X on one screen, group Y is automatically opened on the other screen. You can use hooks to ensure the function is called whenever groups change. Having groups span screens would be harder! |
Beta Was this translation helpful? Give feedback.
-
I did consider that but it would double the number of groups and mess up some semantics. I guess I could use an extra modifier when moving windows to the corresponding group on the other screen. I can definitely imagine that it'd be hard to implement this (seems like a very low-level change), so feel free to close the issue if you aren't planning on adding this. |
Beta Was this translation helpful? Give feedback.
-
There are no immediate plans to implement this (at least, I'm not looking to). I'll move this to a discussion for now in case anyone else wants to add their thoughts (which are always welcome). |
Beta Was this translation helpful? Give feedback.
-
I don't imagine we will implement this internally as we prefer to keep things flexible and configurable enough for users to define their own specific behaviour. This use case is a good example of this as it's already possible (with a bit of work!). My first thought of how to implement it was slightly different than using the hooks - instead you could define your keybindings to directly modify pairs of groups so that they always are kept together. E.g. |
Beta Was this translation helpful? Give feedback.
-
This is how I went about implementing it: @lazy.function
def move_window_to_alternate_group(qtile):
group = int(qtile.current_group.name)
if group < 10:
qtile.current_window.togroup(str(group + 10))
else:
qtile.current_window.togroup(str(group - 10))
keys.extend([Key([mod], "comma", focus_group, desc="Next monitor"),])
@lazy.function
def focus_group(qtile):
group = int(qtile.current_group.name)
if len(qtile.screens) > 1:
qtile.next_screen()
else:
group = int(qtile.current_group.name)
if group < 10:
qtile.current_screen.toggle_group(str(group + 10))
else:
qtile.current_screen.toggle_group(str(group - 10))
# maybe works api
# qtile.current_group.switch_groups('9')
# ^ works but group object needs to be passed
# qtile.groups_map['1'].to_screen()
# qtile.current_screen.set_group('11')
keys.extend([Key([mod , "shift"], "comma", move_window_to_alternate_group, desc="Next monitor"),])
groups = []
for i in range(0,20):
groups.append(Group(str(i)))
for i in range(0,10):
keys.extend(
[
# navigation
# lazy.group[group.name].toscreen(toggle=True),
Key([mod], str(i), lazy.group[str(i)].toscreen(0), lazy.group['1' + str(i)].toscreen(1)),
# move window to group
# Key([mod, "shift"], group.name, lazy.window.togroup(group.name),
Key([mod, "shift"], str(i), lazy.window.togroup( '1' + str(i))),
]
) You can read more about it here : https://sohanglal.github.io/Qtile---make-workspaces-span-across-screens |
Beta Was this translation helpful? Give feedback.
I don't imagine we will implement this internally as we prefer to keep things flexible and configurable enough for users to define their own specific behaviour. This use case is a good example of this as it's already possible (with a bit of work!).
My first thought of how to implement it was slightly different than using the hooks - instead you could define your keybindings to directly modify pairs of groups so that they always are kept together. E.g.
mod+1
could move group A and B to the screens,mod+2
would move groups C and D to the screens. Similarlymod+shift+1
could move the current window to group A or B depending on whether it was on an odd numbered group (i.e. C, E) or even (i.e.…