user/catppuccin: add get_last to theme script
This commit is contained in:
parent
f6cc66d75c
commit
8cd8e9e3dd
1 changed files with 11 additions and 1 deletions
|
|
@ -30,10 +30,20 @@
|
||||||
home.packages = [(pkgs.writeShellScriptBin "theme" ''
|
home.packages = [(pkgs.writeShellScriptBin "theme" ''
|
||||||
last_path="$HOME/.local/state/last-theme"
|
last_path="$HOME/.local/state/last-theme"
|
||||||
target="$1"
|
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
|
if [ "$target" == "restore" ]; then
|
||||||
echo "restoring theme"
|
echo "restoring theme"
|
||||||
if [ ! -e "$last_path" ]; then
|
if [ ! -e "$last_path" ]; then
|
||||||
echo "no last theme found; assuming dark"
|
echo "no last theme found; assuming dark" >&2
|
||||||
target="dark"
|
target="dark"
|
||||||
else
|
else
|
||||||
target=$(cat "$last_path" | tr -d "\n")
|
target=$(cat "$last_path" | tr -d "\n")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue