diff --git a/README.md b/README.md index 285b88a..1711c7d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,12 @@ Use ./stow.sh --unstow to remove configuration - gamemode configuration: - renice=10 - diff for .ohmyzsh via patch files - +- ssh-agent: + - ohmyzsh patch for agent location + - `mv $HOME/.dots/remove-ssh.service ~/.config/systemd/user/remove-ssh.service` + - `systemctl --user start remove-ssh` + - `systemctl --user enable remove-ssh` + ## Software ### Basics diff --git a/remove-ssh.bash b/remove-ssh.bash new file mode 100755 index 0000000..8cf854c --- /dev/null +++ b/remove-ssh.bash @@ -0,0 +1,8 @@ +#!/bin/bash +dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | + while read x; do + case "$x" in + *"boolean true"*) echo SCREEN_LOCKED; ssh-add -D;; + *"boolean false"*) echo SCREEN_UNLOCKED;; + esac + done diff --git a/remove-ssh.service b/remove-ssh.service new file mode 100644 index 0000000..2f62916 --- /dev/null +++ b/remove-ssh.service @@ -0,0 +1,10 @@ +[Unit] +Description=Remove SSH keys on lock + +[Service] +Type=simple +Environment=SSH_AUTH_SOCK=/tmp/agent.sock +ExecStart=%h/.dots/remove-ssh.bash + +[Install] +WantedBy=default.target