Added automatic background detection for locking in i3exit.bash.
This commit is contained in:
BIN
i3/i3/data/lockscreen_1024x600.png
Normal file
BIN
i3/i3/data/lockscreen_1024x600.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 327 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
@@ -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\"."
|
||||||
|
|||||||
Reference in New Issue
Block a user