caelestia/scripts/gen-scheme.fish
2 * r + 2 * t ef97a891c0 scheme: fix scheme update
Fix not updating until next reload
2025-02-22 22:15:10 +11:00

22 lines
642 B
Fish
Executable file

#!/bin/fish
function read-scheme -a scheme_path
cat $scheme_path | while read line
set -l colour (string split ' ' $line)
echo "\$$colour[1] = $colour[2]"
end
end
set -q XDG_STATE_HOME && set -l state $XDG_STATE_HOME || set -l state $HOME/.local/state
set -l scheme_path $state/caelestia/scheme/current.txt
if test -f $scheme_path
set -l tmp (mktemp)
read-scheme $scheme_path > $tmp
if ! cmp -s $tmp ~/.config/hypr/scheme/current.conf
cp $tmp ~/.config/hypr/scheme/current.conf
hyprctl reload
end
else
cp ~/.config/hypr/scheme/default.conf ~/.config/hypr/scheme/current.conf
end