Last active
August 29, 2015 14:10
-
-
Save mubeeniqbal/3a17e7086d0fb039a818 to your computer and use it in GitHub Desktop.
Runs exiting commands (e.g. shutdown, lock, reboot, etc.) for i3 window manager using polkit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Runs exiting commands (e.g. shutdown, lock, reboot, etc.) for i3 window | |
# manager using polkit. | |
# This script is intended to be used with i3wm hotkey combinations. | |
# Usage: i3exit {lock|logout|suspend|hibernate|reboot|shutdown} | |
####################################### | |
# Lock screen in i3wm. | |
# Globals: | |
# None | |
# Arguments: | |
# None | |
# Returns: | |
# None | |
####################################### | |
lock() { | |
i3lock --image="/var/lib/AccountsService/icons/mubeen.png" | |
} | |
main() { | |
case "$1" in | |
lock) lock ;; | |
logout) i3-msg exit ;; | |
suspend) lock && systemctl suspend ;; | |
hibernate) lock && systemctl hibernate ;; | |
reboot) systemctl reboot ;; | |
shutdown) systemctl poweroff ;; | |
*) | |
echo 'Usage: i3exit {lock|logout|suspend|hibernate|reboot|shutdown}' | |
exit 2 | |
esac | |
exit 0 | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment