Skip to content

Post-Script Specification

Post-scripts are shell scripts that run after a pattern is filled. They’re used to reload or restart applications so theme changes take effect immediately. They live in {desktop}/gtheme/post-scripts/.

Naming convention

The script name must match the pattern name it corresponds to:

PatternPost-Script
kitty.patternkitty.sh
dunst.patterndunst.sh
hyprland-colors.patternhyprland-colors.sh

Arguments

The post-script receives the output file path (from the pattern’s <[output-file]>) as its first argument ($1). Not all scripts need this value, but it’s always available.

Example

Here’s a post-script that restarts dunst after its config is regenerated:

#!/bin/bash
pkill dunst &>/dev/null
exit 0

And one that tells kitty to reload its configuration:

#!/bin/bash
pkill -USR1 kitty
exit 0

Special: desktop-exit.sh

There is one special post-script called desktop-exit.sh that runs every time you switch away from the current desktop. It lets you clean up processes specific to the current window manager before applying a new desktop.

#!/bin/sh
sleep 1
killall -u $(whoami)
exit $?