aboutsummaryrefslogtreecommitdiff
path: root/configs/sysmenu/sysmenu.sh
blob: ae35e2de269abff3d3bbd9f9eea8bea35d477d42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
set -e
trap - 2

USER=toni

NOACTIVE=0
while (`true`); do
if [ ${NOACTIVE} -eq 1 ]; then
  while (`true`); do
    echo -n "."
    sleep 1
  done
  break
fi
ANWSER=$(whiptail --nocancel --output-fd 3 --title "sysmenu" --clear --menu "SYSMENU" 15 30 8 "poweroff" "" "reboot" "" "startx" "" "suspend2ram" "" "partymode" "" "hide" "" 3>&1 1>&2 2>&3)

case "${ANWSER}" in
  reboot)
    echo "reboot"
    sudo /sbin/reboot
    break;;
  poweroff)
    echo "poweroff"
    sudo /sbin/poweroff
    break;;
  suspend2ram)
    sudo /usr/sbin/s2ram --force
    break;;
  startx)
    su -l ${USER} -s /bin/bash -c '/usr/bin/startx'
    clear
    ;;
  partymode)
    sudo -u guest -- /usr/bin/startx
    clear
    ;;
  hide)
    clear
    echo -n "[SYSTEM OFFLINE] " >&2
    NOACTIVE=1
    ;;
esac

unset ANSWER
done

sleep 1
exit 0