Manjaro i3 - GitKraken failing due to unset SSH_AUTH_SOCK

I came across on an annoying issue with the SSH_AUTH_SOCK variable not being set correctly on my Manjaro i3wm work machine. This is an issue as the variable needs to be set in order to use GitKraken properly. It turns out that the software wasn't even being correctly loaded in the first place on the community i3 version of Manjaro probably due to the minimalist intended design so I set out to fix that.

First of all we actually need gnome-keyring so using a terminal run pacman -S gnome-keyring to install it.

Next up we need to make some PAM changes so following this guide on the Arch Linux forums I changed the following file:

# /etc/pam.d/login
#%PAM-1.0

auth       required     pam_securetty.so
auth       requisite    pam_nologin.so
auth       include      system-local-login
auth       optional     pam_gnome_keyring.so              #<-- Add this line
account    include      system-local-login
session    include      system-local-login      
session    optional     pam_gnome_keyring.so auto_start   #<-- Add this line

The two important lines highlighted in the file load the gnome keyring pam libraries.

Next we need to add a few lines to the .xinitrc file which can be found in your user's home.

# /home/user/.xinitrc

# get_session(){
#   ... bla ...
# }
...

# Start Gnome keyring
dbus-update-activation-environment --systemd DISPLAY
eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
export SSH_AUTH_SOCK

...
# exec ...

The lines between the dots are added just after the get_session() function but before the exec call to start i3wm. An extra line is also needed in the form of a dbus-update call for i3wm specific reasoning.

After that is sorted we need to add a few lines to the Bash .profile file in order to export the variable for Bash sessions.

# /home/user/.profile

# At the bottom of the file
# ...

# Start gnome ssh keyring daemon
if [ -n "$DESKTOP_SESSION" ];then
    eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
    export SSH_AUTH_SOCK
fi°

At the bottom of the file add the above 5 lines which makes sure that the keyring daemon is actually running and exports the variable we require for GitKraken (and various other programs).

You can now safely restart the system or logout and back in again to load everything up and we should be good to go. We can of course test this by echoing out the variable in the terminal like so:

[user@machine ~]$ echo $SSH_AUTH_SOCK
/run/user/1000/keyring/ssh