mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-08 06:25:37 -05:00
fix loader patterns in settings
- fix matugen command - fix focused window being wrong sometimes
This commit is contained in:
@@ -85,6 +85,8 @@ Singleton {
|
||||
handleWorkspacesChanged(event.WorkspacesChanged)
|
||||
} else if (event.WorkspaceActivated) {
|
||||
handleWorkspaceActivated(event.WorkspaceActivated)
|
||||
} else if (event.WorkspaceActiveWindowChanged) {
|
||||
handleWorkspaceActiveWindowChanged(event.WorkspaceActiveWindowChanged)
|
||||
} else if (event.WindowsChanged) {
|
||||
handleWindowsChanged(event.WindowsChanged)
|
||||
} else if (event.WindowClosed) {
|
||||
@@ -153,6 +155,49 @@ Singleton {
|
||||
workspacesChanged()
|
||||
}
|
||||
|
||||
function handleWorkspaceActiveWindowChanged(data) {
|
||||
// Update the focused window when workspace's active window changes
|
||||
// This is crucial for handling floating window close scenarios
|
||||
if (data.active_window_id !== null && data.active_window_id !== undefined) {
|
||||
focusedWindowId = String(data.active_window_id)
|
||||
focusedWindowIndex = windows.findIndex(w => w.id == data.active_window_id)
|
||||
|
||||
// Create new windows array with updated focus states to trigger property change
|
||||
let updatedWindows = []
|
||||
for (let i = 0; i < windows.length; i++) {
|
||||
let w = windows[i]
|
||||
let updatedWindow = {}
|
||||
for (let prop in w) {
|
||||
updatedWindow[prop] = w[prop]
|
||||
}
|
||||
updatedWindow.is_focused = (w.id == data.active_window_id)
|
||||
updatedWindows.push(updatedWindow)
|
||||
}
|
||||
windows = updatedWindows
|
||||
|
||||
updateFocusedWindow()
|
||||
} else {
|
||||
// No active window in this workspace
|
||||
focusedWindowId = ""
|
||||
focusedWindowIndex = -1
|
||||
|
||||
// Create new windows array with cleared focus states for this workspace
|
||||
let updatedWindows = []
|
||||
for (let i = 0; i < windows.length; i++) {
|
||||
let w = windows[i]
|
||||
let updatedWindow = {}
|
||||
for (let prop in w) {
|
||||
updatedWindow[prop] = w[prop]
|
||||
}
|
||||
updatedWindow.is_focused = w.workspace_id == data.workspace_id ? false : w.is_focused
|
||||
updatedWindows.push(updatedWindow)
|
||||
}
|
||||
windows = updatedWindows
|
||||
|
||||
updateFocusedWindow()
|
||||
}
|
||||
}
|
||||
|
||||
function handleWindowsChanged(data) {
|
||||
windows = [...data.windows].sort((a, b) => a.id - b.id)
|
||||
updateFocusedWindow()
|
||||
|
||||
Reference in New Issue
Block a user