refactor(quickshell): simplify workspace ID handling in Workspaces.qml and Lock.qml

This commit is contained in:
ATDMA
2026-02-01 17:06:53 -05:00
parent 15ceda494e
commit 68f0355940
2 changed files with 2 additions and 4 deletions
@@ -18,8 +18,7 @@ Item {
property bool borderless: Config.options.bar.borderless
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(root.QsWindow.window?.screen)
readonly property Toplevel activeWindow: ToplevelManager.activeToplevel
// Clamp to avoid lock-screen temp workspace (2147483647 - N) leaking into UI
readonly property int effectiveActiveWorkspaceId: Math.max(1, Math.min(100, monitor?.activeWorkspace?.id ?? 1))
readonly property int effectiveActiveWorkspaceId: monitor?.activeWorkspace?.id ?? 1
readonly property int workspacesShown: Config.options.bar.workspaces.shown
readonly property int workspaceGroup: Math.floor((effectiveActiveWorkspaceId - 1) / root.workspacesShown)
@@ -23,7 +23,7 @@ LockScreen {
for (var j = 0; j < Quickshell.screens.length; ++j) {
var monName = Quickshell.screens[j].name
var wsId = root.savedWorkspaces[monName]
if (wsId !== undefined && wsId >= 1 && wsId <= 100) {
if (wsId !== undefined) {
batch += "dispatch focusmonitor " + monName + "; dispatch workspace " + wsId + "; "
}
}
@@ -49,7 +49,6 @@ LockScreen {
var mon = Quickshell.screens[i].name
var mData = HyprlandData.monitors.find(m => m.name === mon)
var ws = (mData?.activeWorkspace?.id ?? 1)
if (ws < 1 || ws > 100) ws = 1
next[mon] = ws
batch += "dispatch focusmonitor " + mon + "; dispatch workspace " + (2147483647 - ws) + "; "
}