fix(theme): stop the update script from stalling wallpaper switches
execAsync resolves only once stdout/stderr reach EOF, and update_script.sh started dunst with '&' so the daemon inherited AGS's captured pipes. Once theme switches were serialized behind themeQueue, that pending promise blocked every later switch, including the one restoreTheme() queues at startup, so clicking a wallpaper did nothing. - detach dunst with setsid and redirected stdio in update_script.sh - run update_script.sh with its fds detached and without awaiting it, so user-added commands can never stall the queue
This commit is contained in:
1 parent
58749dcbdc
commit
6347fdbc2a
2 files changed
+22
-9
No files matched your search
@@ -207,13 +207,25 @@ async function applyTheme(wallpaperPath: string) {
|
|||||||
// 4. Keep the greetd greeter in sync with the current palette/wallpaper
|
// 4. Keep the greetd greeter in sync with the current palette/wallpaper
|
||||||
await exportGreeterTheme()
|
await exportGreeterTheme()
|
||||||
|
|
||||||
// 5. Run update script
|
// 5. Refresh the rest of the system (dunst, hyprland, ...). Deliberately not
|
||||||
try {
|
// awaited, so nothing the script does can stall the theme queue.
|
||||||
const agsDir = `${HOME}/.config/ags`
|
runUpdateScript()
|
||||||
await execAsync([`${agsDir}/update_script.sh`])
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to run update script:", error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run update_script.sh detached from our stdio.
|
||||||
|
*
|
||||||
|
* execAsync resolves only once stdout/stderr reach EOF. A daemon started with
|
||||||
|
* `&` in the script would inherit those pipes and keep the promise pending
|
||||||
|
* forever, which used to block every queued theme switch after the first one.
|
||||||
|
*/
|
||||||
|
function runUpdateScript() {
|
||||||
|
const script = `${HOME}/.config/ags/update_script.sh`
|
||||||
|
return execAsync([
|
||||||
|
"bash",
|
||||||
|
"-c",
|
||||||
|
`"${script}" >/dev/null 2>&1 </dev/null`,
|
||||||
|
]).catch((error) => console.error("Failed to run update script:", error))
|
||||||
}
|
}
|
||||||
|
|
||||||
let themeQueue: Promise<void> = Promise.resolve()
|
let themeQueue: Promise<void> = Promise.resolve()
|
||||||
|
|||||||
+4
-3
@@ -1,8 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#Dunst notification daemon
|
# Dunst notification daemon.
|
||||||
|
# Detach it from this script's stdio: AGS only resolves execAsync once the
|
||||||
|
# captured pipes are closed, so an inherited fd here would stall the caller.
|
||||||
killall dunst
|
killall dunst
|
||||||
dunst &
|
setsid -f dunst >/dev/null 2>&1 </dev/null
|
||||||
|
|
||||||
hyprctl reload
|
hyprctl reload
|
||||||
|
|
||||||
Reference in new issue
Block a user