feat(zsh): add screensaver

This commit is contained in:
Mohammad Rafiq 2025-05-21 19:55:25 +08:00
parent 92d7ab9b29
commit 6d61b159a0
No known key found for this signature in database
3 changed files with 12 additions and 8 deletions

View file

@ -6,7 +6,8 @@
{ {
cli.shell = "zsh"; cli.shell = "zsh";
cli.screensaver.enable = true; cli.screensaver.enable = true;
cli.screensaver.timeout = "10"; cli.screensaver.timeout = "100";
cli.screensaver.command = "cbonsai -S";
cli.editor = "nvf"; cli.editor = "nvf";
cli.file-browser = "yazi"; cli.file-browser = "yazi";
cli.multiplexer = "zellij"; cli.multiplexer = "zellij";
@ -20,6 +21,7 @@
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
cbonsai
ripgrep ripgrep
devenv devenv
pantheon.rebuild pantheon.rebuild

View file

@ -9,6 +9,7 @@
shell = lib.pantheon.mkStrOption; shell = lib.pantheon.mkStrOption;
screensaver.enable = lib.mkEnableOption ""; screensaver.enable = lib.mkEnableOption "";
screensaver.timeout = lib.pantheon.mkStrOption; screensaver.timeout = lib.pantheon.mkStrOption;
screensaver.command = lib.pantheon.mkStrOption;
editor = lib.pantheon.mkStrOption; editor = lib.pantheon.mkStrOption;
file-browser = lib.pantheon.mkStrOption; file-browser = lib.pantheon.mkStrOption;
multiplexer = lib.pantheon.mkStrOption; multiplexer = lib.pantheon.mkStrOption;

View file

@ -21,15 +21,16 @@
lib.mkOrder 1200 lib.mkOrder 1200
# zsh # zsh
'' ''
setopt PROMPT_SUBST precmd() {
PROMPT='> ' TMOUT=${config.cli.screensaver.timeout}
RPROMPT='[%D{%L:%M:%S %p}]' }
TMOUT=${config.cli.screensaver.timeout}
TRAPALRM() { TRAPALRM() {
PROMPT='IDLE > ' TMOUT=1
zle reset-prompt ${config.cli.screensaver.command}
# If we exit, assume the previous command was exited out of
TMOUT=${config.cli.screensaver.timeout}
zle reset-prompt
} }
'' ''
); );