i3-workspace-groups
i3-workspace-groups copied to clipboard
Polybar module & multi-monitor group switching
Hello,
There was a problem with the polybar module on a multi-screen setup. The workspaces were not ordered, so the first commit fixes that.
I also observed that if you have a multi monitor setup and you change the active group the focused workspace changes only on the focused monitor. This leads to a confusion (at least for me), because you then have one group on one monitor and one group in the other. I think I fixed this with the second commit.
What do you think about that? I am available to make things proper if there are some problems.
Hi and thanks for the PR. Can you please remove the formatting changes? they make it hard to see what functional changes you've made. I previously formatted the code with yapf in google style, but I may switch to black in the future since it looks more popular in the community. Anyway, I prefer to make any formatting changes separately from other PRs.
Regarding the group switching in multiple monitors, the command if you use i3-workspace-groups switch-active-group
there's a parameter --focused-monitor-only
which controls if it happens in all monitors or only the focused one. It defaults to false, so the groups switching should happen in all monitors, as long there's at least one workspace from that group, you can see the code here: https://github.com/infokiller/i3-workspace-groups/blob/master/i3wsgroups/controller.py#L155-L171
When you switched the group with multiple monitors, did this group exist in a monitor, but the group was not activated? if so, that's a bug, so please let me know and I can try to fix it.
If the group does not exist in the other monitor, there's no real way to switch to it without changing focus, so I don't think it should be done by default, although we can add a parameter to control this if needed.
Anyway, let's try to make every PR focused on one thing.
Thanks!
Hey, sorry for the messy PR! I will try to fix it as soon as I can.
Regarding the group switching in multiple monitors, the command if you use i3-workspace-groups switch-active-group there's a parameter --focused-monitor-only which controls if it happens in all monitors or only the focused one.
This does not seem to be the case, at least on my setup. If I 'switch-active-group' the workspace on the unfocused monitor stays the same, even if there is an active WS in the new active group. It could be that I'm doing something wrong.
Can you please try the following command and see if anything looks wrong (you can also post the output here or in an issue and I'll take a look): i3-workspace-groups --log-level=debug switch-active-group <your_group>
I only use one monitor on my desktop so I'll try to test it with my laptop, but the last time I tried it worked.
@cdutsov friendly ping
I'm on a dual monitor setup !
I can confirm that the i3-workspace-groups --log-level=debug switch-active-group <your_group>
command does not yield the expected result.
On the monitor where the command is launched, the workspace is correctly swapped, but on the second one it is not.
This is the log output :
2022-05-13 09:30:05,516 DEBUG [i3-workspace-groups:201] Using merged config:
{'icons': {'default_icon': '',
'delimiter': '',
'enable': False,
'enable_all_groups': False,
'min_duplicates_count': 3,
'rules': [{'icon': '\ue795',
'match': 'kitty|Termite|URxvtc?',
'property': 'class'},
{'icon': '\ue743',
'match': 'Chromium|Chrome',
'property': 'class'},
{'icon': '\ue745',
'match': 'Firefox',
'property': 'class'},
{'icon': '\uf0ea', 'match': 'copyq', 'property': 'class'},
{'icon': '\ue5fe', 'match': 'Ranger', 'property': 'class'},
{'icon': '\uf120', 'match': 'Rofi', 'property': 'class'},
{'icon': '\ue244', 'match': 'Pqiv', 'property': 'class'},
{'icon': '\ue22b', 'match': 'Pinta', 'property': 'class'},
{'icon': '\uf008', 'match': '[Mm]pv', 'property': 'class'},
{'icon': '嗢', 'match': '[Vv]lc', 'property': 'class'},
{'icon': '\uf1c2',
'match': '[Ll]ibreoffice-writer',
'property': 'class'},
{'icon': '\uf1c3',
'match': '[Ll]ibreoffice-calc',
'property': 'class'},
{'icon': '\uf03d', 'match': 'Peek', 'property': 'class'},
{'icon': '\ue235',
'match': 'ipython',
'property': 'class'},
{'icon': '\ue235', 'match': 'python', 'property': 'class'},
{'icon': '\ue235',
'match': 'jupyter-qtconsole',
'property': 'class'},
{'icon': '\ue7c5', 'match': 'Gvim', 'property': 'class'},
{'icon': '\uf013',
'match': 'settings',
'property': 'class'},
{'icon': '聆', 'match': 'slack', 'property': 'class'},
{'icon': '\uf725',
'match': 'Zathura',
'property': 'class'},
{'icon': '\ue215',
'match': 'Telegram',
'property': 'class'},
{'icon': '墳',
'match': 'Pavucontrol',
'property': 'class'}],
'try_fallback_rules': True},
'renumber_workspaces': False}
2022-05-13 09:30:05,518 DEBUG [workspace_names.py:251] Workspace 2:Rivp:2 parsed as: {'global_number': 2, 'group': 'Rivp', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,518 DEBUG [workspace_names.py:251] Workspace 101:Test:1 parsed as: {'global_number': 101, 'group': 'Test', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,518 DEBUG [workspace_names.py:251] Workspace 202:Smi:2 parsed as: {'global_number': 202, 'group': 'Smi', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,518 DEBUG [controller.py:160] Switching active group in focused monitor "DP-1"
2022-05-13 09:30:05,518 DEBUG [workspace_names.py:251] Workspace 2:Rivp:2 parsed as: {'global_number': 2, 'group': 'Rivp', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,518 DEBUG [workspace_names.py:251] Workspace 101:Test:1 parsed as: {'global_number': 101, 'group': 'Test', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,518 DEBUG [workspace_names.py:251] Workspace 202:Smi:2 parsed as: {'global_number': 202, 'group': 'Smi', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,519 DEBUG [workspace_names.py:251] Workspace 2:Rivp:2 parsed as: {'global_number': 2, 'group': 'Rivp', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,519 DEBUG [workspace_names.py:251] Workspace 101:Test:1 parsed as: {'global_number': 101, 'group': 'Test', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,519 DEBUG [workspace_names.py:251] Workspace 202:Smi:2 parsed as: {'global_number': 202, 'group': 'Smi', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,519 DEBUG [workspace_names.py:251] Workspace 100001:Rivp:1 parsed as: {'global_number': 100001, 'group': 'Rivp', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,519 DEBUG [workspace_names.py:251] Workspace 100102:Test:2 parsed as: {'global_number': 100102, 'group': 'Test', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,519 DEBUG [workspace_names.py:251] Workspace 100201:Smi:1 parsed as: {'global_number': 100201, 'group': 'Smi', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,519 DEBUG [controller.py:68] Organizing workspace group: "Rivp" in monitor "DP-1"
2022-05-13 09:30:05,519 DEBUG [workspace_names.py:191] Local numbers used by group in other monitors: {1}
2022-05-13 09:30:05,519 DEBUG [controller.py:68] Organizing workspace group: "Test" in monitor "DP-1"
2022-05-13 09:30:05,519 DEBUG [workspace_names.py:191] Local numbers used by group in other monitors: {2}
2022-05-13 09:30:05,519 DEBUG [controller.py:68] Organizing workspace group: "Smi" in monitor "DP-1"
2022-05-13 09:30:05,519 DEBUG [workspace_names.py:191] Local numbers used by group in other monitors: {1}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 100001:Rivp:1 parsed as: {'global_number': 100001, 'group': 'Rivp', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 100102:Test:2 parsed as: {'global_number': 100102, 'group': 'Test', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 100201:Smi:1 parsed as: {'global_number': 100201, 'group': 'Smi', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,520 DEBUG [controller.py:163] Non focused monitor eDP-1 has workspaces in the group "Rivp", switching to it.
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 100001:Rivp:1 parsed as: {'global_number': 100001, 'group': 'Rivp', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 100102:Test:2 parsed as: {'global_number': 100102, 'group': 'Test', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 100201:Smi:1 parsed as: {'global_number': 100201, 'group': 'Smi', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 2:Rivp:2 parsed as: {'global_number': 2, 'group': 'Rivp', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 101:Test:1 parsed as: {'global_number': 101, 'group': 'Test', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 202:Smi:2 parsed as: {'global_number': 202, 'group': 'Smi', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 100001:Rivp:1 parsed as: {'global_number': 100001, 'group': 'Rivp', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 100102:Test:2 parsed as: {'global_number': 100102, 'group': 'Test', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:251] Workspace 100201:Smi:1 parsed as: {'global_number': 100201, 'group': 'Smi', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,520 DEBUG [controller.py:68] Organizing workspace group: "Rivp" in monitor "eDP-1"
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:191] Local numbers used by group in other monitors: {2}
2022-05-13 09:30:05,520 DEBUG [controller.py:68] Organizing workspace group: "Test" in monitor "eDP-1"
2022-05-13 09:30:05,520 DEBUG [workspace_names.py:191] Local numbers used by group in other monitors: {1}
2022-05-13 09:30:05,521 DEBUG [controller.py:68] Organizing workspace group: "Smi" in monitor "eDP-1"
2022-05-13 09:30:05,521 DEBUG [workspace_names.py:191] Local numbers used by group in other monitors: {2}
2022-05-13 09:30:05,521 DEBUG [workspace_names.py:251] Workspace 2:Rivp:2 parsed as: {'global_number': 2, 'group': 'Rivp', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,521 DEBUG [workspace_names.py:251] Workspace 101:Test:1 parsed as: {'global_number': 101, 'group': 'Test', 'static_name': '', 'dynamic_name': '', 'local_number': 1}
2022-05-13 09:30:05,521 DEBUG [workspace_names.py:251] Workspace 202:Smi:2 parsed as: {'global_number': 202, 'group': 'Smi', 'static_name': '', 'dynamic_name': '', 'local_number': 2}
2022-05-13 09:30:05,521 INFO [i3_proxy.py:71] Sending i3 command: 'workspace --no-auto-back-and-forth "2:Rivp:2"'
@CaptainQuirk did that group exist in the other monitor? if not, this behavior is expected. See my comment here for background: https://github.com/infokiller/i3-workspace-groups/issues/29#issuecomment-578389656
@CaptainQuirk ok I can see from the log that you have the same groups in both monitors, is that correct? Can you please show the full command you are running (including the workspace name)? Also, what version are you using and how did you install it?