diff --git a/bin/omarchy-toggle b/bin/omarchy-toggle new file mode 100755 index 00000000..7db467fa --- /dev/null +++ b/bin/omarchy-toggle @@ -0,0 +1,26 @@ +#!/bin/bash + +# Toggle Omarchy features between enabled and disabled + +ENABLED_NOTIFICATION="" +DISABLED_NOTIFICATION="" + +while [[ $# -gt 1 ]]; do + case $1 in + --enabled-notification) ENABLED_NOTIFICATION="$2"; shift 2 ;; + --disabled-notification) DISABLED_NOTIFICATION="$2"; shift 2 ;; + *) break ;; + esac +done + +FLAG_NAME="$1" +FLAG="$HOME/.local/state/omarchy/toggles/$FLAG_NAME" + +if [[ -f $FLAG ]]; then + rm $FLAG + [[ -n $DISABLED_NOTIFICATION ]] && notify-send -u low "$DISABLED_NOTIFICATION" +else + mkdir -p "$(dirname $FLAG)" + touch $FLAG + [[ -n $ENABLED_NOTIFICATION ]] && notify-send -u low "$ENABLED_NOTIFICATION" +fi diff --git a/bin/omarchy-toggle-suspend b/bin/omarchy-toggle-suspend index ab7d9e76..cd0d2191 100755 --- a/bin/omarchy-toggle-suspend +++ b/bin/omarchy-toggle-suspend @@ -1,12 +1,6 @@ #!/bin/bash -STATE_FILE=~/.local/state/omarchy/toggles/suspend-off - -if [[ -f $STATE_FILE ]]; then - rm -f $STATE_FILE - notify-send -u low "󰒲 Suspend now available in system menu" -else - mkdir -p "$(dirname $STATE_FILE)" - touch $STATE_FILE - notify-send -u low "󰒲 Suspend removed from system menu" -fi +omarchy-toggle \ + --enabled-notification "󰒲 Suspend removed from system menu" \ + --disabled-notification "󰒲 Suspend now available in system menu" \ + suspend-off