#!/bin/sh

# Description:      Kill all ssh connections
#                   Delete all ssh agents
#                   Ensure to kill all ssh-agent
#                   Ensure to kill all gpg-agent
#                   Lock the screen
### Give an easy way to call this function with a keybind.
## For example with herbstluftwm: "hc keybind $Mod-Shift-c spawn ~/bin/veille.sh"

## depend: i3lock

# SSH Connections
killall ssh
rm -rf ~/.ssh/socks/*
# SSH Agent
killall ssh-agent
rm -rf /tmp/ssh-*
# GPG Agent
keychain --agents gpg --clear
killall gpg-agent
# Delete everything link to ssh-agent or gpg-agent
rm -rf ~/.keychain/*
# Keepass2 (killall keepass, both those launch with 'mono' and those launch with 'cli)
ps ax | grep -v 'awk' | awk '/keepass2/,NF=1' | xargs kill
# Delete sensitive files can contains unwanted clear passwords
rm -f ~/.config/evince/print-settings ~/.config/eog/eog-print-settings.ini ~/.gimp-2.8/print-settings
# Lock the screen
#i3lock -c 000000 --pointer win -d
i3lock -i /home/jegardai/Images/system/empire_needs_you.png --pointer win -d -e -t
