user/catppuccin: add get_last to theme script

This commit is contained in:
LavaDesu 2025-03-19 14:06:32 +11:00
parent f6cc66d75c
commit 8cd8e9e3dd
Signed by: cilly
GPG key ID: 6500251E087653C9

View file

@ -30,10 +30,20 @@
home.packages = [(pkgs.writeShellScriptBin "theme" ''
last_path="$HOME/.local/state/last-theme"
target="$1"
if [ "$target" == "get_last" ]; then
if [ ! -e "$last_path" ]; then
echo "no last theme found; assuming dark" >&2
target="dark"
else
target=$(cat "$last_path" | tr -d "\n")
fi
echo "$target"
exit 0
fi
if [ "$target" == "restore" ]; then
echo "restoring theme"
if [ ! -e "$last_path" ]; then
echo "no last theme found; assuming dark"
echo "no last theme found; assuming dark" >&2
target="dark"
else
target=$(cat "$last_path" | tr -d "\n")