mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
refactor(quickshell): simplify workspace ID handling in Workspaces.qml and Lock.qml
This commit is contained in:
@@ -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) + "; "
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user