2015-05-29 21:08:06 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-06-02 12:07:25 +02:00
|
|
|
cd $(dirname $0)
|
|
|
|
|
|
|
|
DMENU="./dmenu.sh"
|
2015-05-29 21:08:06 +02:00
|
|
|
menu() {
|
|
|
|
echo $@ | tr ' ' '\n' | $DMENU
|
|
|
|
}
|
|
|
|
|
|
|
|
screenshot() {
|
|
|
|
cd ~/Screenshots
|
|
|
|
exec scrot $@ -e 'firefox $f'
|
|
|
|
}
|
|
|
|
|
|
|
|
sysctl() {
|
|
|
|
action=$1
|
|
|
|
service=$2
|
2015-07-22 15:18:04 +02:00
|
|
|
gksu -S -m "$action $service" systemctl $action $service
|
2015-05-29 21:08:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
require-service() {
|
|
|
|
service=$1
|
|
|
|
systemctl is-active --quiet $service || sysctl start $service
|
|
|
|
}
|
|
|
|
|
2015-09-02 15:11:49 +02:00
|
|
|
case "$(menu timer cpu screenshot wallpaper wicd ncmpcpp ssh zomnet power)" in
|
2015-05-29 21:08:06 +02:00
|
|
|
timer)
|
|
|
|
exec urxvt -geometry 50x3 -e ~/.config/scripts/teatimer.sh
|
|
|
|
;;
|
2015-09-02 15:11:49 +02:00
|
|
|
cpu)
|
|
|
|
choice=$(menu performance powersave)
|
|
|
|
case $choice in
|
|
|
|
performance|powersave)
|
|
|
|
exec gksu -S -m "Setting cpu to $choice" "cpupower frequency-set -g $choice"
|
|
|
|
esac
|
|
|
|
;;
|
2015-05-29 21:08:06 +02:00
|
|
|
screenshot)
|
|
|
|
case "$(menu all selective)" in
|
|
|
|
all)
|
|
|
|
screenshot
|
|
|
|
;;
|
|
|
|
selective)
|
|
|
|
screenshot -s
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
wallpaper)
|
|
|
|
exec nitrogen ~/wallpapers
|
|
|
|
;;
|
|
|
|
wicd)
|
|
|
|
exec wicd-gtk
|
|
|
|
;;
|
|
|
|
ncmpcpp)
|
|
|
|
exec urxvt -e ncmpcpp
|
|
|
|
;;
|
2015-06-02 12:07:25 +02:00
|
|
|
ssh)
|
|
|
|
host=$(menu `./ssh_hosts.sh`)
|
|
|
|
if [ -n "$host" ]; then
|
2015-06-08 16:46:15 +02:00
|
|
|
exec urxvt -e $HOME/.config/scripts/sshw.sh $host
|
2015-06-02 12:07:25 +02:00
|
|
|
fi
|
|
|
|
;;
|
2015-05-29 21:08:06 +02:00
|
|
|
zomnet)
|
|
|
|
case "$(menu start-stop uservm ncmpcpp deluge)" in
|
|
|
|
start-stop)
|
|
|
|
systemctl is-active zomnet > /dev/null
|
|
|
|
if [ "$?" -eq 0 ]; then
|
|
|
|
sysctl stop zomnet
|
|
|
|
else
|
|
|
|
sysctl start zomnet
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
uservm)
|
|
|
|
require-service zomnet
|
|
|
|
exec urxvt -e ssh user.vm.zom.bi
|
|
|
|
;;
|
|
|
|
ncmpcpp)
|
|
|
|
require-service zomnet
|
|
|
|
exec urxvt -e ncmpcpp -h user.vm.zom.bi
|
|
|
|
;;
|
|
|
|
deluge)
|
|
|
|
require-service zomnet
|
|
|
|
exec deluge-gtk
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
power)
|
|
|
|
case "$(menu hibernate suspend reboot poweroff)" in
|
|
|
|
hibernate)
|
|
|
|
systemctl hibernate
|
|
|
|
;;
|
|
|
|
suspend)
|
|
|
|
systemctl suspend
|
|
|
|
;;
|
|
|
|
reboot)
|
|
|
|
systemctl reboot
|
|
|
|
;;
|
|
|
|
poweroff)
|
|
|
|
systemctl poweroff
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|