user/catppuccin: persist theme on reboot
This commit is contained in:
parent
3c5d4ba108
commit
f9de112a18
1 changed files with 16 additions and 3 deletions
|
|
@ -34,8 +34,19 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = [(pkgs.writeShellScriptBin "theme" ''
|
home.packages = [(pkgs.writeShellScriptBin "theme" ''
|
||||||
if [ "$1" != "dark" ] && [ "$1" != "light" ]; then
|
last_path="$HOME/.local/state/last-theme"
|
||||||
echo "invalid theme, valid values: [dark, light]"
|
target="$1"
|
||||||
|
if [ "$target" == "restore" ]; then
|
||||||
|
echo "restoring theme"
|
||||||
|
if [ ! -e "$last_path" ]; then
|
||||||
|
echo "no last theme found; assuming dark"
|
||||||
|
target="dark"
|
||||||
|
else
|
||||||
|
target=$(cat "$last_path" | tr -d "\n")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$target" != "dark" ] && [ "$target" != "light" ]; then
|
||||||
|
echo "invalid theme, valid values: [dark, light, restore]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
current="$HOME/.local/state/nix/profiles/home-manager"
|
current="$HOME/.local/state/nix/profiles/home-manager"
|
||||||
|
|
@ -52,7 +63,9 @@
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$cached/specialisation/$1/activate"
|
"$cached/specialisation/$target/activate"
|
||||||
|
|
||||||
|
echo "$target" > "$last_path"
|
||||||
'')];
|
'')];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue