Add target to split automatically
This commit is contained in:
parent
6dddeb9c2e
commit
1752ef64d8
2 changed files with 21 additions and 3 deletions
|
@ -1,3 +1,5 @@
|
|||
target="${args[target]}"
|
||||
|
||||
ts_clients=$(teamspeak-query-lib clients --uid)
|
||||
ts_online=$(grep ~/.config/ts-control/steam_map.txt -Ff <(echo "$ts_clients" | awk '{print $1}'))
|
||||
friend_ids=$(echo "$ts_online" | awk '{print $1}' | paste -sd ',')
|
||||
|
@ -47,13 +49,26 @@ create_prompt() {
|
|||
groups=$(create_groups)
|
||||
prompt=$(create_prompt "$groups")
|
||||
|
||||
selected=$(echo "$prompt" | $DMENU)
|
||||
filter=""
|
||||
|
||||
if [ -n "$target" ]
|
||||
then
|
||||
filter="^. *$target$" # START INDEX SPACES TARGET (broken for index > 9)
|
||||
fi
|
||||
|
||||
selected=$(_ts_control_single_or_dmenu "$prompt" "$filter")
|
||||
if [ -z "$selected" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
target_channel=$(teamspeak-query-lib channels | $DMENU --prompt "Channel" || true)
|
||||
if [ -z "$target_channel" ]; then
|
||||
target_channel=""
|
||||
if [ -z "$target" ] # ask for channel if no target is specified
|
||||
then
|
||||
target_channel=$(teamspeak-query-lib channels | $DMENU --prompt "Channel" || true)
|
||||
fi
|
||||
|
||||
if [ -z "$target_channel" ] # use first empty channel if no channel is specified
|
||||
then
|
||||
target_channel=$(teamspeak-query-lib channels --only-empty | head -n 1)
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue