sway: add lock/idle actions

This commit is contained in:
Konstantin Koslowski 2020-12-18 15:33:47 +01:00
parent ec29615e6a
commit 7af7d8dbde
2 changed files with 21 additions and 11 deletions

19
config
View file

@ -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

13
lock Executable file
View file

@ -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