From 7ecf60c59b0c31ea57bd3b2c24c401a0486ac517 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sat, 30 Sep 2017 16:02:46 +0200 Subject: [PATCH] Allow to lock the screen using i3lock --- .config/i3/config | 3 +++ bin/lock | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100755 bin/lock diff --git a/.config/i3/config b/.config/i3/config index 506009f..fd94d6f 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -152,6 +152,9 @@ bindsym $mod+r mode "resize" # Screenshot 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 # finds out, if available) bar { diff --git a/bin/lock b/bin/lock new file mode 100755 index 0000000..2bca112 --- /dev/null +++ b/bin/lock @@ -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"