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