summaryrefslogtreecommitdiff
path: root/quickshell/gruvbar/scripts/action.sh
diff options
context:
space:
mode:
Diffstat (limited to 'quickshell/gruvbar/scripts/action.sh')
-rwxr-xr-xquickshell/gruvbar/scripts/action.sh83
1 files changed, 83 insertions, 0 deletions
diff --git a/quickshell/gruvbar/scripts/action.sh b/quickshell/gruvbar/scripts/action.sh
new file mode 100755
index 0000000..80d26d3
--- /dev/null
+++ b/quickshell/gruvbar/scripts/action.sh
@@ -0,0 +1,83 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+action="${1:-}"
+arg="${2:-}"
+polybar_scripts="/home/aag/.config/polybar/scripts"
+
+run_existing() {
+ local script="$1"
+ shift
+
+ if [ -x "$polybar_scripts/$script" ]; then
+ exec "$polybar_scripts/$script" "$@"
+ fi
+}
+
+case "$action" in
+ awake)
+ run_existing awake-toggle.sh "$arg"
+ ;;
+ clipboard)
+ run_existing clipboard-menu.sh
+ ;;
+ display)
+ run_existing display-toggle.sh
+ ;;
+ display-brightness)
+ run_existing display-brightness.sh "${arg:-up}"
+ ;;
+ dunst)
+ command -v dunstctl >/dev/null 2>&1 || exit 0
+ case "$arg" in
+ history) dunstctl history-pop ;;
+ close) dunstctl close-all ;;
+ *) dunstctl set-paused toggle ;;
+ esac
+ ;;
+ keyboard)
+ run_existing kb-switch.sh
+ ;;
+ mic)
+ run_existing mic-toggle.sh
+ ;;
+ music)
+ command -v playerctl >/dev/null 2>&1 || exit 0
+ case "$arg" in
+ prev) playerctl previous ;;
+ next) playerctl next ;;
+ *) playerctl play-pause ;;
+ esac
+ ;;
+ power)
+ run_existing power-menu.sh
+ ;;
+ screenshot)
+ run_existing screenshot-menu.sh
+ ;;
+ scratch)
+ command -v i3-msg >/dev/null 2>&1 || exit 0
+ case "$arg" in
+ move) i3-msg move scratchpad ;;
+ *) i3-msg scratchpad show ;;
+ esac
+ ;;
+ updates)
+ run_existing updates-action.sh
+ ;;
+ volume)
+ command -v pactl >/dev/null 2>&1 || {
+ [ "$arg" = "" ] && command -v pavucontrol >/dev/null 2>&1 && exec pavucontrol
+ exit 0
+ }
+ case "$arg" in
+ up) pactl set-sink-volume @DEFAULT_SINK@ +5% ;;
+ down) pactl set-sink-volume @DEFAULT_SINK@ -5% ;;
+ mute) pactl set-sink-mute @DEFAULT_SINK@ toggle ;;
+ *) command -v pavucontrol >/dev/null 2>&1 && pavucontrol ;;
+ esac
+ ;;
+ wg)
+ run_existing wg-pc-toggle.sh "$arg"
+ ;;
+esac