Update exit script
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
### From http://www.archlinux.org/index.php/i3
|
||||
|
||||
_logfile="$LOGDIR/i3/i3exit.log"
|
||||
LOCKSCREEN="$LIBDIR/wallpaper/lockscreen"
|
||||
|
||||
_fallback_color=000000
|
||||
|
||||
@@ -16,10 +17,12 @@ log()
|
||||
|
||||
lock()
|
||||
{
|
||||
if [[ "$LOCKSCREEN" ]] ; then
|
||||
i3lock --show-failed-attempts --image "$LOCKSCREEN"
|
||||
if [[ -f "$LOCKSCREEN" ]] ; then
|
||||
i3lock --nofork --show-failed-attempts --ignore-empty-password \
|
||||
--pointer win --image "$LOCKSCREEN"
|
||||
else
|
||||
i3lock --show-failed-attempts --color "$_fallback_color"
|
||||
i3lock --nofork --show-failed-attempts --ignore-empty-password \
|
||||
--color "$_fallback_color"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -27,13 +30,26 @@ screen_off() {
|
||||
xset dpms force off
|
||||
}
|
||||
|
||||
reset_screen() {
|
||||
xset -dpms
|
||||
xset s off
|
||||
}
|
||||
|
||||
lock_and_screen_off() {
|
||||
lock &
|
||||
_pid=$!
|
||||
screen_off
|
||||
wait $_pid
|
||||
reset_screen
|
||||
}
|
||||
|
||||
signal="$1"
|
||||
log "[I] Received signal \"$signal\"."
|
||||
|
||||
case "$signal" in
|
||||
lock)
|
||||
log "[I] Locking session."
|
||||
lock && screen_off
|
||||
lock_and_screen_off
|
||||
;;
|
||||
logout)
|
||||
log "[I] Exiting i3."
|
||||
@@ -41,7 +57,8 @@ case "$signal" in
|
||||
;;
|
||||
suspend)
|
||||
log "[I] Suspending."
|
||||
lock && systemctl suspend
|
||||
lock_and_screen_off &
|
||||
systemctl suspend
|
||||
;;
|
||||
hibernate)
|
||||
log "[I] Hibernating."
|
||||
@@ -57,7 +74,7 @@ case "$signal" in
|
||||
;;
|
||||
screen-off)
|
||||
log "[I] Turning screen off."
|
||||
screen_off
|
||||
lock_and_screen_off
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
|
||||
|
||||
Reference in New Issue
Block a user