From 7af7d8dbdef3c0fc833d33da90de90a954bbd172 Mon Sep 17 00:00:00 2001 From: Konstantin Koslowski Date: Fri, 18 Dec 2020 15:33:47 +0100 Subject: [PATCH] sway: add lock/idle actions --- config | 19 ++++++++----------- lock | 13 +++++++++++++ 2 files changed, 21 insertions(+), 11 deletions(-) create mode 100755 lock diff --git a/config b/config index f5509d1..b610950 100644 --- a/config +++ b/config @@ -16,6 +16,8 @@ set $right l # Your preferred terminal emulator set $term termite set $background $HOME/Cloud/xkonni/Pictures/wallpaper/5k_bavarian_forest_bw.jpg +set lock_cmd $HOME/.config/sway/lock + # Your preferred application launcher # Note: pass the final command to swaymsg so that the resulting window can be opened # on the original workspace that the command was run on. @@ -31,17 +33,12 @@ output DP-1 pos 1920 0 output DP-1 disable ### Idle configuration -# -# Example configuration: -# -# exec swayidle -w \ -# timeout 300 'swaylock -f -c 000000' \ -# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ -# before-sleep 'swaylock -f -c 000000' -# -# This will lock your screen after 300 seconds of inactivity, then turn off -# your displays after another 300 seconds, and turn your screens back on when -# resumed. It will also lock your screen before your computer goes to sleep. +bindsym $mod+Ctrl+Escape exec $lock_cmd +exec swayidle -w \ + timeout 300 '$lock_cmd' \ + timeout 600 'swaymsg "output * dpms off"' \ + resume 'swaymsg "output * dpms on"' \ + before-sleep '$lock_cmd' ### Input configuration # You can get the names of your inputs by running: swaymsg -t get_inputs diff --git a/lock b/lock new file mode 100755 index 0000000..bcdb773 --- /dev/null +++ b/lock @@ -0,0 +1,13 @@ +#!/bin/bash +IMAGE=/tmp/screen_locked.png +APP=grim + +which $APP &> /dev/null +if [ $? -eq 0 ]; then + $APP $IMAGE + convert -blur 4x4 $IMAGE $IMAGE + swaylock -f -c 000000 -i $IMAGE + rm -v $IMAGE +else + swaylock -f -c 000000 +fi