From 6d61b159a023ad7dba26f08306d6dcbc01812bb9 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 21 May 2025 19:55:25 +0800 Subject: [PATCH] feat(zsh): add screensaver --- homes/x86_64-linux/rafiq/default.nix | 4 +++- modules/home/cli/default.nix | 1 + modules/home/cli/shell/default.nix | 15 ++++++++------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/homes/x86_64-linux/rafiq/default.nix b/homes/x86_64-linux/rafiq/default.nix index 2ed815c..de893bd 100644 --- a/homes/x86_64-linux/rafiq/default.nix +++ b/homes/x86_64-linux/rafiq/default.nix @@ -6,7 +6,8 @@ { cli.shell = "zsh"; cli.screensaver.enable = true; - cli.screensaver.timeout = "10"; + cli.screensaver.timeout = "100"; + cli.screensaver.command = "cbonsai -S"; cli.editor = "nvf"; cli.file-browser = "yazi"; cli.multiplexer = "zellij"; @@ -20,6 +21,7 @@ }; home.packages = with pkgs; [ + cbonsai ripgrep devenv pantheon.rebuild diff --git a/modules/home/cli/default.nix b/modules/home/cli/default.nix index 911fd2b..fd325b1 100644 --- a/modules/home/cli/default.nix +++ b/modules/home/cli/default.nix @@ -9,6 +9,7 @@ shell = lib.pantheon.mkStrOption; screensaver.enable = lib.mkEnableOption ""; screensaver.timeout = lib.pantheon.mkStrOption; + screensaver.command = lib.pantheon.mkStrOption; editor = lib.pantheon.mkStrOption; file-browser = lib.pantheon.mkStrOption; multiplexer = lib.pantheon.mkStrOption; diff --git a/modules/home/cli/shell/default.nix b/modules/home/cli/shell/default.nix index 425499b..966a01d 100644 --- a/modules/home/cli/shell/default.nix +++ b/modules/home/cli/shell/default.nix @@ -21,15 +21,16 @@ lib.mkOrder 1200 # zsh '' - setopt PROMPT_SUBST - PROMPT='> ' - RPROMPT='[%D{%L:%M:%S %p}]' - - TMOUT=${config.cli.screensaver.timeout} + precmd() { + TMOUT=${config.cli.screensaver.timeout} + } TRAPALRM() { - PROMPT='IDLE > ' - zle reset-prompt + TMOUT=1 + ${config.cli.screensaver.command} + # If we exit, assume the previous command was exited out of + TMOUT=${config.cli.screensaver.timeout} + zle reset-prompt } '' );