summaryrefslogtreecommitdiffstats
path: root/bin/power.sh
blob: 809e24c57b007f63e9ac31afbd5fe2e66acf55a0 (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
#!/bin/bash

# Simple script to handle a DIY shutdown menu. When run you should see a bunch of options (shutdown, reboot etc.)
#
# Requirements:
# - rofi
# - systemd, but you can replace the commands for OpenRC or anything else
#
# Instructions:
# - Save this file as power.sh or anything
# - Give it exec priviledge, or chmod +x /path/to/power.sh
# - Run it

chosen=$(echo -e "lock\nshutdown\nrestart" | rofi -dmenu -i)
# Info about some states are available here:
# https://www.freedesktop.org/software/systemd/man/systemd-sleep.conf.html#Description

if [[ $chosen = "lock" ]]; then
    i3lock -i ~/Dropbox/Wallpapers/current/breakfast.jpg --clock --time-font="FuraCode Nerd Font" --timesize=144 --datestr="" --timecolor=fefefeee --timestr="%H:%M" --radius=45 --timepos="ix:iy-250"
elif [[ $chosen = "shutdown" ]]; then
    systemctl poweroff
elif [[ $chosen = "restart" ]]; then
    systemctl reboot
fi