teamspeak-query-lib/ts-control

58 lines
1.2 KiB
Text
Raw Normal View History

2023-11-13 16:01:23 +00:00
#!/usr/bin/env sh
2023-11-17 16:32:15 +00:00
actions="move
fetch-client
fetch-channel
away
not away
back"
action=$(echo "$actions" | $DMENU)
2023-11-13 16:01:23 +00:00
2023-11-26 21:30:59 +00:00
_ts_control_move_self() {
channel=$(teamspeak-query-lib channels | $DMENU)
if [ -z "$channel" ]; then
return 1
fi
teamspeak-query-lib move --strict-channel "$channel"
return 0
2023-11-13 16:01:23 +00:00
}
2023-11-26 21:30:59 +00:00
_ts_control_fetch() {
2023-11-17 16:32:15 +00:00
target=$(teamspeak-query-lib "$1s" | $DMENU)
if [ -z "$target" ]; then
exit 1
fi
teamspeak-query-lib fetch "--strict-$1" "--$1" "$target"
}
2023-11-13 16:01:23 +00:00
case $action in
"move")
2023-11-26 21:30:59 +00:00
_ts_control_move_self
;;
2023-11-17 16:32:15 +00:00
"fetch-client")
2023-11-26 21:30:59 +00:00
_ts_control_fetch client
2023-11-17 16:32:15 +00:00
;;
"fetch-channel")
2023-11-26 21:30:59 +00:00
_ts_control_fetch channel
;;
"not away")
teamspeak-query-lib move "Not Away From Keyboard"
teamspeak-query-lib update --microphone=false --speakers=false
2023-11-13 16:01:23 +00:00
;;
"away")
message=$(printf "\n" | $DMENU -p "message")
if [ -z "$message" ]; then
exit 1
fi
2023-11-13 16:01:23 +00:00
teamspeak-query-lib move "Away From Keyboard"
teamspeak-query-lib update --away "$message"
teamspeak-query-lib update --microphone=false --speakers=false --away "$message"
;;
"back")
teamspeak-query-lib update --back
ts_control_move_self
2023-11-13 16:01:23 +00:00
teamspeak-query-lib update --microphone=true --speakers=true
;;
esac