Hyprland
Hyprland copied to clipboard
Persistent workspaces are not always kept on the correct (specified) monitor
Discussion Link
https://github.com/hyprwm/Hyprland/discussions/9879
Description
More information in the discussion, but in some specific cases, workspaces marked persistent do not stay on their assigned monitor (provided they have one.
Provided by OP:
I looked a bit around the source code and If I understand things correctly:
- Workspace rules are processed in CConfigManager::handleWorkspaceRules
- They get the
idfrom getWorkspaceIDNameFromString- Because they are named (e.g.
name:L1) theidcomes from CCompositor::getNextAvailableNamedWorkspace- Since no workspace was created yet, they all get the same (
-1337) id- Then CCompositor::ensurePersistentWorkspacesPresent (through
CConfigManager::ensurePersistentWorkspacesPresent) creates all the workspaces- Since their
ids are not set toWORKSPACE_INVALID, they (-1337) are used to fetch the workspace and move it to the correct monitor, but this results in all moves working on the same workspace.
Explicitly setting the
wsRule.workspaceIdtoWORKSPACE_INVALIDin CConfigManager::handleWorkspaceRules solves the problem, but > I have no clue how to fix this correctly.
@vaxerski u forgot to replace the old issues that were in the milestones including this 1
doesn't really matter. I realize.
@LokiNaBoki is this still an issue on -git?
It is still present on f1f1161c179374f7f703f7a17b1680205904cc90
I just checked v0.51.0 and it looks like all workspaces are on the correct monitors, but when both persistent:true and default:true are specified, some workspaces are duplicated.
Using this config:
$MONITOR_L = HDMI-A-1
$MONITOR_R = DP-3
monitor = $MONITOR_L, 1280x1024@75, 0x0, 1
monitor = $MONITOR_R, 1920x1080@60, 1280x0, 1
workspace = name:L1, monitor:$MONITOR_L,persistent:true,default:true
workspace = name:L2, monitor:$MONITOR_L,persistent:true,default:true
workspace = name:R1, monitor:$MONITOR_R,persistent:true,default:true
workspace = name:R2, monitor:$MONITOR_R,persistent:true,default:true
bind = SUPER, 1, workspace,name:L1
bind = SUPER, 2, workspace,name:L2
bind = SUPER SHIFT, 1, workspace,name:R1
bind = SUPER SHIFT, 2, workspace,name:R2
bind = SUPER, M, exit
bind = SUPER, T, exec,kitty
Starting Hyprland and going through every workspace opening a terminal on each results in this hyprctl workspaces output:
workspace ID -1341 (R1) on monitor DP-3:
monitorID: 0
windows: 1
hasfullscreen: 0
lastwindow: 0x55c28dca5320
lastwindowtitle: ~/.config/hypr
ispersistent: 0
workspace ID -1342 (L1) on monitor HDMI-A-1:
monitorID: 1
windows: 1
hasfullscreen: 0
lastwindow: 0x55c28dc1cf80
lastwindowtitle: ~/.config/hypr
ispersistent: 0
workspace ID -1337 (L1) on monitor HDMI-A-1:
monitorID: 1
windows: 0
hasfullscreen: 0
lastwindow: 0x0
lastwindowtitle:
ispersistent: 1
workspace ID -1338 (L2) on monitor HDMI-A-1:
monitorID: 1
windows: 1
hasfullscreen: 0
lastwindow: 0x55c28dc672f0
lastwindowtitle: ~/.config/hypr
ispersistent: 1
workspace ID -1339 (R1) on monitor DP-3:
monitorID: 0
windows: 0
hasfullscreen: 0
lastwindow: 0x0
lastwindowtitle:
ispersistent: 1
workspace ID -1340 (R2) on monitor DP-3:
monitorID: 0
windows: 1
hasfullscreen: 0
lastwindow: 0x55c28dcc2700
lastwindowtitle: hyprctl workspaces > /tmp/workspaces
ispersistent: 1
Both R1 and L1 are duplicated. That being said I think this is a different issue, should I open a new discussion?
Probably? Does it happen with ID-based workspaces too?
With IDs instead of names there is no duplication
$MONITOR_L = HDMI-A-1
$MONITOR_R = DP-3
monitor = $MONITOR_L, 1280x1024@75, 0x0, 1
monitor = $MONITOR_R, 1920x1080@60, 1280x0, 1
workspace = 1, monitor:$MONITOR_L,persistent:true,default:true
workspace = 2, monitor:$MONITOR_L,persistent:true,default:true
workspace = 11, monitor:$MONITOR_R,persistent:true,default:true
workspace = 12, monitor:$MONITOR_R,persistent:true,default:true
bind = SUPER, 1, workspace,1
bind = SUPER, 2, workspace,2
bind = SUPER SHIFT, 1, workspace,11
bind = SUPER SHIFT, 2, workspace,12
bind = SUPER, M, exit
bind = SUPER, T, exec,kitty
workspace ID 11 (11) on monitor DP-3:
monitorID: 0
windows: 1
hasfullscreen: 0
lastwindow: 0x55970d65aa70
lastwindowtitle: ~/.config/hypr
ispersistent: 1
workspace ID 1 (1) on monitor HDMI-A-1:
monitorID: 1
windows: 1
hasfullscreen: 0
lastwindow: 0x55970d5d2c70
lastwindowtitle: ~/.config/hypr
ispersistent: 1
workspace ID 2 (2) on monitor HDMI-A-1:
monitorID: 1
windows: 1
hasfullscreen: 0
lastwindow: 0x55970d61ddb0
lastwindowtitle: ~/.config/hypr
ispersistent: 1
workspace ID 12 (12) on monitor DP-3:
monitorID: 0
windows: 1
hasfullscreen: 0
lastwindow: 0x55970d677cd0
lastwindowtitle: hyprctl workspaces > /tmp/workspaces
ispersistent: 1
I have opened a new discussion about the duplicated workspaces: #12084. The problem from this issue is resolved, so I think it can be closed.