Skip to content

Instantly share code, notes, and snippets.

@Nervengift
Last active May 18, 2016 21:06
Show Gist options
  • Save Nervengift/fe10896bef9b7a9884e857871f5d5ccd to your computer and use it in GitHub Desktop.
Save Nervengift/fe10896bef9b7a9884e857871f5d5ccd to your computer and use it in GitHub Desktop.
dmenu/rofi menu for Entropia's sound board
#!/usr/bin/bash
# use sound effects at Entropia via a dmenu
# run "snd update" to load and update the local cache of available sounds
#
# by Nervengift
[[ "x$XDG_CACHE_HOME" == "x" ]] && CACHEDIR="$HOME/.cache" || CACHEDIR="$XDG_CACHE_HOME"
[[ "x$1" == "xupdate" ]] && ssh entropia@voellerei.club.entropia.de bash -c \'find /home/entropia/clubautomation/snd -type f -printf \"%P\\n\" \' | tee $CACHEDIR/snd_dmenu
[[ -e "$CACHEDIR/snd_dmenu" ]] || (echo "No cache found, run $0 update first!" && exit 1)
selection=$(cat "$CACHEDIR/snd_dmenu" | while read foo; do echo ${foo%.*}; done | dmenu -l 10 -p 'Sound effect: ')
echo $selection > /dev/udp/voellerei.club.entropia.de/23421
#!/usr/bin/bash
# use sound effects at Entropia via a rofi menu
# run "snd update" to load and update the local cache of available sounds
# then simply use "snd" to open the menu
#
# by Nervengift
[[ "x$XDG_CACHE_HOME" == "x" ]] && CACHEDIR="$HOME/.cache" || CACHEDIR="$XDG_CACHE_HOME"
[[ "x$1" == "xupdate" ]] && ssh entropia@voellerei.club.entropia.de bash -c \'find /home/entropia/clubautomation/snd -type f -printf \"%P\\n\" \' | tee $CACHEDIR/snd_dmenu
[[ -e "$CACHEDIR/snd_dmenu" ]] || (echo "No cache found, run $0 update first!" && exit 1)
selection=$(cat "$CACHEDIR/snd_dmenu" | while read foo; do echo ${foo%.*}; done | rofi -dmenu -p 'Sound effect: ' -location 6 -width 100)
echo $selection > /dev/udp/voellerei.club.entropia.de/23421
@Nervengift
Copy link
Author

Nervengift commented May 18, 2016

btw: rofi is the better dmenu :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment