Fix space/tab and add "not away" in ts-control

This commit is contained in:
Tobias Reisinger 2023-11-14 13:31:18 +01:00
parent 13abafae9d
commit 970c1ee2c2
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE

View file

@ -1,39 +1,43 @@
#!/usr/bin/env sh #!/usr/bin/env sh
action=$(printf "move\nfetch\naway\nback" | $DMENU) action=$(printf "move\nfetch\naway\nnot away\nback" | $DMENU)
ts_control_move_self() { ts_control_move_self() {
channel=$(teamspeak-query-lib channels | $DMENU) channel=$(teamspeak-query-lib channels | $DMENU)
if [ -z "$channel" ]; then if [ -z "$channel" ]; then
return 1 return 1
fi fi
teamspeak-query-lib move --strict-channel "$channel" teamspeak-query-lib move --strict-channel "$channel"
return 0 return 0
} }
case $action in case $action in
"move") "move")
ts_control_move_self ts_control_move_self
;;
"fetch")
client=$(teamspeak-query-lib clients | $DMENU)
if [ -z "$client" ]; then
exit 1
fi
teamspeak-query-lib fetch --strict-client "$client"
;;
"not away")
teamspeak-query-lib move "Not Away From Keyboard"
teamspeak-query-lib update --microphone=false --speakers=false
;; ;;
"fetch")
client=$(teamspeak-query-lib clients | $DMENU)
if [ -z "$client" ]; then
exit 1
fi
teamspeak-query-lib fetch --strict-client "$client"
;;
"away") "away")
message=$(printf "\n" | $DMENU -p "message") message=$(printf "\n" | $DMENU -p "message")
if [ -z "$message" ]; then if [ -z "$message" ]; then
exit 1 exit 1
fi fi
teamspeak-query-lib move "Away From Keyboard" teamspeak-query-lib move "Away From Keyboard"
teamspeak-query-lib update --away "$message" teamspeak-query-lib update --away "$message"
teamspeak-query-lib update --microphone=false --speakers=false --away "$message" teamspeak-query-lib update --microphone=false --speakers=false --away "$message"
;; ;;
"back") "back")
teamspeak-query-lib update --back teamspeak-query-lib update --back
ts_control_move_self ts_control_move_self
teamspeak-query-lib update --microphone=true --speakers=true teamspeak-query-lib update --microphone=true --speakers=true
;; ;;
esac esac