| 1 | #!/bin/sh |
| 2 | |
| 3 | export XDIALOG_HIGH_DIALOG_COMPAT=true; |
| 4 | DISPLAY=':0.0'; |
| 5 | dialog="dialog"; #(dialog|whiptail|Xdialog|gdialog); |
| 6 | tmpfile="/tmp/caudacui-$$.tmp"; |
| 7 | |
| 8 | #ssh keepalive |
| 9 | while true; do |
| 10 | sleep 1; |
| 11 | echo -ne '\x00'; |
| 12 | done & |
| 13 | |
| 14 | #menu loop |
| 15 | while true; do |
| 16 | "$dialog" --title "Harvie's Remote Textmode UI for Audacious & amixer" --no-shadow --menu '' 0 0 0\ |
| 17 | ' -t' '|> PLAY/PAUSE'\ |
| 18 | ' -s' '## STOP'\ |
| 19 | ' -f' '>> FWD'\ |
| 20 | ' -r' '<< REV'\ |
| 21 | ' -p' '-> PLAY'\ |
| 22 | ' -u' '|| PAUSE'\ |
| 23 | ' 100%' '-- VOLUME MAX'\ |
| 24 | ' 5%+' '-- VOLUME +5dB'\ |
| 25 | ' 5%-' '-- VOLUME -5dB'\ |
| 26 | ' 0%- toggle' 'xx MUTE'\ |
| 27 | 2>"$tmpfile"; |
| 28 | if [[ "$?" != 0 ]]; then |
| 29 | kill "$!"; >/dev/null 2>&1 |
| 30 | rm -f "$tmpfile"; |
| 31 | exit; |
| 32 | fi; |
| 33 | echo 'Processing...'; |
| 34 | if ( grep '%' -F "$tmpfile" ); then |
| 35 | amixer -c 0 sset Master $(cat "$tmpfile"); |
| 36 | continue; |
| 37 | fi; |
| 38 | audacious -n 0 $(cat "$tmpfile"); |
| 39 | done; |