Skip to content

Instantly share code, notes, and snippets.

@leafo
Created March 29, 2016 08:06
Show Gist options
  • Save leafo/de849f2a8c189f04cd9d to your computer and use it in GitHub Desktop.
Save leafo/de849f2a8c189f04cd9d to your computer and use it in GitHub Desktop.
#!/bin/sh
function menu {
dmenu -i -l 20 -fn 'Terminus-16' $@
}
function refreshawesome {
echo 'require("leaf.status").refresh()' | awesome-client
}
current=$(hamster current)
# choose an action
if [ "No activity" = "$current" ]; then
action="start"
else
action=$(echo -e -n "start\nstop $current" | menu -p Action)
fi
[ -z "$action" ] && exit 1
case "$action" in
start)
activity=$(hamster activities | menu -p Start)
[ -z "$activity" ] && exit 1
hamster start "$activity"
notify-send "Started $activity"
refreshawesome
;;
stop*)
hamster stop
notify-send "Stopped $current"
refreshawesome
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment