Created
December 20, 2023 14:17
-
-
Save Tomcat-42/b9840e6da90362c701e7cad38eec8b0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function dmenu() { | |
for opt in "${@:2}"; do | |
echo "$opt" | |
done | command dmenu -p "$1" -l 7 | |
} | |
function toggle_daemon() { | |
if pgrep -x "picom" >/dev/null && pgrep -x "gromit-mpx" >/dev/null; then | |
pkill -x "picom" | |
pkill -x "gromit-mpx" | |
else | |
picom & | |
gromit-mpx -a & | |
fi | |
} | |
COMMANDS=("turn the daemon on/off" "clear the screen" "toggle cursor" "toggle visibility" "redo" "undo" "change monitor") | |
choosen=$(dmenu "wacom : " "${COMMANDS[@]}") | |
case $choosen in | |
"turn the daemon on/off") | |
toggle_daemon | |
;; | |
"clear the screen") | |
gromit-mpx -c | |
;; | |
"toggle cursor") | |
gromit-mpx -t | |
;; | |
"toggle visibility") | |
gromit-mpx -v | |
;; | |
"redo") | |
gromit-mpx -y | |
;; | |
"undo") | |
gromit-mpx -z | |
;; | |
"change monitor") | |
readarray -t monitors < <(mapwacom --list-screens) | |
monitor=$(dmenu "Choose monitor: " "${monitors[@]}") | |
mapwacom --device-regexp ".*" --screen "$monitor" | |
;; | |
*) | |
echo "No valid option selected." | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment