From d20d5c774f12275d59d579129d4d086bae268b95 Mon Sep 17 00:00:00 2001 From: M1dgard Date: Mon, 11 Mar 2019 11:18:16 +0100 Subject: [PATCH] Add lock script that clears key caches --- i3/config | 2 +- i3/lock.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 i3/lock.sh diff --git a/i3/config b/i3/config index 801de66..cf3df92 100644 --- a/i3/config +++ b/i3/config @@ -92,7 +92,7 @@ bindsym $mod+c mode $macromode ################ # lock the screen -bindsym Mod1+l exec --no-startup-id i3lock --tiling --show-failed-attempts --color=000000 --image="$HOME/img/bg/Red-billed_streamertail_Trochilus_polytmus_female_in_flight_2_lock.png" || notify-send -u normal -i lock -a i3 "Failed to lock screen" "i3lock had a non-zero exit code." +bindsym Mod1+l exec --no-startup-id $HOME/.config/i3/lock.sh # start a terminal bindsym $mod+Return exec $term diff --git a/i3/lock.sh b/i3/lock.sh new file mode 100755 index 0000000..ec793a2 --- /dev/null +++ b/i3/lock.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if ! ssh-add -D; then + notify-send -u normal -i lock -a i3 'Failed to clear SSH key cache' 'ssh-add had a non-zero exit code.' +fi + +if ! gpg-connect-agent reloadagent /bye; then + notify-send -u normal -i lock -a i3 'Failed to clear GPG key cache' 'gpg-connect-agent had a non-zero exit code.' +fi + +if ! i3lock --tiling --lock-console --show-failed-attempts --color=000000 --image="$HOME/img/bg/Red-billed_streamertail_Trochilus_polytmus_female_in_flight_2_lock.png"; then + notify-send -u normal -i lock -a i3 'Failed to lock screen' 'i3lock had a non-zero exit code.' +fi