From 8cd8e9e3dd5a270847d5c19bf3a7e28ba565adb0 Mon Sep 17 00:00:00 2001 From: LavaDesu Date: Wed, 19 Mar 2025 14:06:32 +1100 Subject: [PATCH] user/catppuccin: add get_last to theme script --- modules/user/catppuccin.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/user/catppuccin.nix b/modules/user/catppuccin.nix index 3679328..ece7f62 100644 --- a/modules/user/catppuccin.nix +++ b/modules/user/catppuccin.nix @@ -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")