summaryrefslogtreecommitdiff
path: root/rofi/.config/rofi/rofi-power.sh
blob: 6aecdbb5761c715a55bb8e31a426ec3c46cb8c08 (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
#!/usr/bin/env bash

OPTIONS="Reboot\nShut-down\nSuspend\nLock"

# source configuration or use default values
  LAUNCHER="rofi -location 5 -width 15 -lines 4 -dmenu -i -p power -show-icons "
  USE_LOCKER="true"
  LOCKER="/home/ssaini/.config/lock.sh"


# Show exit wm option if exit command is provided as an argument
if [ ${#1} -gt 0 ]; then
  OPTIONS="Exit window manager\n$OPTIONS"
fi

option=`echo -e $OPTIONS | $LAUNCHER | awk '{print $1}' | tr -d '\r\n'`
if [ ${#option} -gt 0 ]
then
    case $option in
      Exit)
        eval $1
        ;;
      Reboot)
        reboot
        ;;
      Shut-down)
        poweroff
        ;;
      Suspend)
	suspend
        ;;
      Lock)
        light-locker-command -l
        ;;
      *)
        ;;
    esac
fi