summaryrefslogtreecommitdiff
path: root/.i3lock/lock.sh
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-12-23 14:03:02 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-12-23 14:03:02 +0200
commite3567781db43e840587903fd0ca0b3a16e9202ef (patch)
tree609143f2f9a2f030d911e18be127190850c030e4 /.i3lock/lock.sh
parent26b9ff01382a0bb4a7363a54a14cad173d10d172 (diff)
downloaddotfiles-e3567781db43e840587903fd0ca0b3a16e9202ef.tar
dotfiles-e3567781db43e840587903fd0ca0b3a16e9202ef.tar.gz
dotfiles-e3567781db43e840587903fd0ca0b3a16e9202ef.zip
Updated configs for Funtoo
Diffstat (limited to '.i3lock/lock.sh')
-rwxr-xr-x.i3lock/lock.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/.i3lock/lock.sh b/.i3lock/lock.sh
index 277d727..9ec6d4c 100755
--- a/.i3lock/lock.sh
+++ b/.i3lock/lock.sh
@@ -1,11 +1,16 @@
#!/bin/bash
+## Helper functions
res () {
pkill $@
nohup $@ 2>&1 &
disown
}
+# ++=================================++
+# || Actions before and after unlock ||
+# ++=================================++
+
before_locking () {
# Disables dunst, my notification daemon, so I don't see notification on lock screen
# https://github.com/dunst-project/dunst/issues/697
@@ -25,6 +30,10 @@ when_unlocked_after_suspend () {
gtk-launch picom # sometimes my compositor stops working after suspend, this makes sure it's running
}
+# ++==================================++
+# || Prevent locking because of audio ||
+# ++==================================++
+
# This makes sure to not lock the screen if audio is playing and there are no arguments given
# It's mainly for preventing automatic screen locking while a video/music is playing
# If you still want to lock, just give it some argument, doesn't matter what
@@ -50,6 +59,10 @@ if [ $(grep -r 'RUNNING' /proc/asound | wc -l) -gt 1 ] && [[ "$1" == 'suspend' ]
exit
fi
+# ++============================++
+# || Lock if not locked already ||
+# ++============================++
+
if ! pgrep i3lock 1>&2; then
# The first line of i3lock arguments uses standard arguments, while the rest of the lines are i3lock-color ones
# If you want to use i3lock, remove those lines (and the \ at the end)
@@ -65,6 +78,10 @@ if ! pgrep i3lock 1>&2; then
) &
fi
+# ++=========++
+# || Suspend ||
+# ++=========++
+
if [[ "$1" == 'suspend' ]]; then
# A file is created to indicate that the system was suspended
# After i3lock is done (unlocked), existence of this file is checked to determine if