Compare commits

..
2 Commits
Author SHA1 Message Date
pascalyazid 123760d643 Added theming docs for Ghostty 2026-11-30 16:59:19 +01:00
pascalyazid 6347fdbc2a 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
2026-11-27 19:15:34 +01:00
4 changed files with 57 additions and 10 deletions

No files matched your search

+10 -1
View File
@@ -188,7 +188,16 @@ include ~/.cache/wal/colors-kitty.conf
_Next time you open Kitty, it will perfectly match your wallpaper._ _Next time you open Kitty, it will perfectly match your wallpaper._
### Example 2: Dunst (Notification Daemon) ### Example 2: Ghostty
Ghostty allows to link custom theme files. copy the `templates/colors-ghostty-custom` file to `~/.config/wal/templates`.
Then, in your Ghostty config file `~/.config/ghostty/config.ghostty` add this line:
```conf
config-file = ?~/.cache/wal/colors-ghostty-custom
```
Ghostty will hot reload the theme and also save it for the next time you open it.
### Example 3: Dunst (Notification Daemon)
Pywal doesn't generate a theme for every application, hence you have to define some templates yourself in `~/.config/wal/templates`. Pywal doesn't generate a theme for every application, hence you have to define some templates yourself in `~/.config/wal/templates`.
In this case we will create a template for Dunst: In this case we will create a template for Dunst:
+25
View File
@@ -0,0 +1,25 @@
# Pywal 16-color template for Ghostty
palette = 0={color0}
palette = 1={color1}
palette = 2={color2}
palette = 3={color3}
palette = 4={color4}
palette = 5={color5}
palette = 6={color6}
palette = 7={color7}
palette = 8={color8}
palette = 9={color9}
palette = 10={color10}
palette = 11={color11}
palette = 12={color12}
palette = 13={color13}
palette = 14={color14}
palette = 15={color15}
background = {background}
foreground = {foreground}
cursor-color = {cursor}
selection-background = {color4}
selection-foreground = {background}
background-opacity = 0.85
+18 -6
View File
@@ -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
View File
@@ -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