Added automatic background detection for locking in i3exit.bash.

This commit is contained in:
2013-09-15 22:14:43 +02:00
parent 55e36d31cd
commit 91b4b22634
3 changed files with 14 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -5,6 +5,8 @@
LOGFILE="$HOME/.i3/logs/i3exit.log" LOGFILE="$HOME/.i3/logs/i3exit.log"
LOGFILE_MAXSIZE=100000 LOGFILE_MAXSIZE=100000
FALLBACK_COLOR=000000
[[ $(stat -c%s "$LOGFILE") -gt $LOGFILE_MAXSIZE ]] && >$LOGFILE [[ $(stat -c%s "$LOGFILE") -gt $LOGFILE_MAXSIZE ]] && >$LOGFILE
log() log()
@@ -14,7 +16,18 @@ log()
lock() lock()
{ {
i3lock --image="$HOME/.i3/data/lockscreen.png" resolution=$(xrandr | grep \* | cut -d " " -f 4)
log "[I] Resolution found: \"$resolution\""
lockscreen="$HOME/.i3/data/lockscreen_$resolution.png"
log "[I] Looking for lockscreen at \"$lockscreen\""
if [[ -f "$lockscreen" ]] ; then
log "[I] Lockscreen found, will be used as background image."
background_options="--image $lockscreen"
else
log "[W] Lockscreen not found, using color #$FALLBACK_COLOR as background."
background_options="--color $FALLBACK_COLOR"
fi
i3lock $background_options
} }
log "[I] Received signal \"$1\"." log "[I] Received signal \"$1\"."