Allow to lock the screen using i3lock

This commit is contained in:
Rodolphe Breard 2017-09-30 16:02:46 +02:00
parent 603b23636b
commit 7ecf60c59b
2 changed files with 14 additions and 0 deletions

View file

@ -152,6 +152,9 @@ bindsym $mod+r mode "resize"
# Screenshot # Screenshot
bindsym Print exec scrot -e 'mv $f ~/pictures/ 2>/dev/null' bindsym Print exec scrot -e 'mv $f ~/pictures/ 2>/dev/null'
# Screen lock
bindsym control+l exec 'lock'
# Start i3bar to display a workspace bar (plus the system information i3status # Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available) # finds out, if available)
bar { bar {

11
bin/lock Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
set -euo pipefail
IFS=$'\n\t'
LOCK_BG_FILE="/tmp/lock_screen.png"
scrot "$LOCK_BG_FILE"
mogrify -filter Gaussian -resize 50% -define filter:sigma=2.5 -resize 200% "$LOCK_BG_FILE"
mogrify -font Liberation-Sans -fill white -undercolor '#00000080' -pointsize 30 -gravity South -annotate +0+200 "Screen locked" "$LOCK_BG_FILE"
i3lock -e -i "$LOCK_BG_FILE"