From bb38c8714c1653ba0ba4ece19203d6c2c61f1b75 Mon Sep 17 00:00:00 2001 From: SDGDen Date: Wed, 3 Jun 2026 11:08:00 +0200 Subject: [PATCH] added a toggle for tipme command to change between normal and cowsay mode. --- ghostty/config.ghostty | 2 +- sdgos/tips/tips.sh | 41 +++++++++++++++++++++++++++++++++++++++++ sdgos/zshconfig.zsh | 2 +- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100755 sdgos/tips/tips.sh diff --git a/ghostty/config.ghostty b/ghostty/config.ghostty index f345a0c..576b660 100644 --- a/ghostty/config.ghostty +++ b/ghostty/config.ghostty @@ -4,7 +4,7 @@ background-opacity = 0.7 command = /bin/zsh -initial-command = /bin/zsh -c ~/.config/sdgos/fastfetch/fetch.sh && echo "" && shuf -n 1 ~/.config/sdgos/tips/tips.list && echo "[SDG-OS Tips]: use the 'tipme' command for random tips" && echo "[SDG-OS Tips]: 'alltips' to see all tips in a searchable interface" && echo "[SDG-OS Tips]: or the SUPER+0 keybind to be notified of a random tip" && zsh +initial-command = /bin/zsh -c ~/.config/sdgos/fastfetch/fetch.sh && echo "" && ~/.config/sdgos/tips/tips.sh && echo "[SDG-OS Tips]: use the 'tipme' command for random tips" && echo "[SDG-OS Tips]: 'alltips' to see all tips in a searchable interface" && echo "[SDG-OS Tips]: 'tipme toggle' to toggle between normal mode and cowsay mode" && echo "[SDG-OS Tips]: or the SUPER+0 keybind to be notified of a random tip" && zsh scrollback-limit = 999999 diff --git a/sdgos/tips/tips.sh b/sdgos/tips/tips.sh new file mode 100755 index 0000000..5d70cc1 --- /dev/null +++ b/sdgos/tips/tips.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +if [ ! -e ~/.config/tips.state ]; then + echo "standard" > ~/.config/tips.state +fi + +SETTING=$(cat ~/.config/tips.state) + +INPUT="$1" + +case $INPUT in + "") + case $SETTING in + standard) + shuf -n 1 ~/.config/sdgos/tips/tips.list + ;; + cow) + cowsay -r $(shuf -n 1 ~/.config/sdgos/tips/tips.list) | lolcat + ;; + esac + ;; + toggle) + case $SETTING in + standard) + echo "cow" > ~/.config/tips.state + ;; + cow) + echo "standard" > ~/.config/tips.state + ;; + esac + ;; + standard) + echo "standard" > ~/.config/tips.state + shuf -n 1 ~/.config/sdgos/tips/tips.list + ;; + + cow) + echo "cow" > ~/.config/tips.state + cowsay -r $(shuf -n 1 ~/.config/sdgos/tips/tips.list) | lolcat + ;; +esac \ No newline at end of file diff --git a/sdgos/zshconfig.zsh b/sdgos/zshconfig.zsh index 4ee2753..ad2e65d 100644 --- a/sdgos/zshconfig.zsh +++ b/sdgos/zshconfig.zsh @@ -23,7 +23,7 @@ alias apt='man pacman' alias apt-get='man pacman' alias jctl="journalctl -p 3 -xb" alias cmdhist='CMD=$(history -i | tac | fzf | sed "s/.*:.. //"); sleep 0.1 && wtype $CMD' -alias tipme='shuf -n 1 ~/.config/sdgos/tips/tips.list' +alias tipme='~/.config/sdgos/tips/tips.sh' alias alltips='cat ~/.config/sdgos/tips/tips.list | fzf' alias cowtip='cowsay -r $(shuf -n 1 ~/.config/sdgos/tips/tips.list) | lolcat' alias fetch='~/.config/sdgos/fastfetch/fetch.sh'