My fix for openSUSE 16.0, ssh-agent Plasma wayland

At least on openSUSE, one of my frustrations with Plasma wayland is lack of automatic ssh-agent so I can just load my key into my session (because ssh-agent is already there) and use it. Solutions that are driven by individual shell aren’t great because again, in good ole X11, we had the ssh-agent. But, still, want it to be user based, just automatic with SSH_AUTH_SOCK present for anything launched from the desktop. That is, so virt-manager tunneling can use it, so that Remmina can use it, konsole, etc. Now, in all fairness I distinguish work from home use, so my ssh-add (to add in my work key) is deliberate and after login and usually done from a shell as part of my normal work day. So, my solution doesn’t do anything about pre-loading special keys automatically, just makes sure the ssh-agent and environment variable is present for all programs started after I login (start plasma).

My ~/.config/plasma-workspace/env/ssh-agent-start.sh (to start the agent for wayland and get the env variables into the whole plasma session):

#!/bin/bash
if [ "${XDG_SESSION_TYPE}" = 'wayland' ]; then
  eval $(/usr/bin/ssh-agent -s)
fi

Then, on ending a session, you want some cleanup to prevent a myriad of ssh-agents from building up.

My ~/.config/plasma-workspace/shutdown/ssh-agent-stop.sh:

#!/bin/bash
if [ "$XDG_SESSION_TYPE" = 'wayland' ]; then
  eval $(/usr/bin/ssh-agent -k)
fi

Anyway, this is my answer. There’s a lot of complex and not so great answers out there. Hoping somebody finds this useful.