Created
May 16, 2020 03:51
-
-
Save kppullin/93ecf587d91b40f30ca0f1f374fbc6ee to your computer and use it in GitHub Desktop.
Fish shell + WSL2 + gnome-keyring / secret-tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This fish config sets up a working `gnome-keyring` on WSL2. | |
# I imagine it will work with WSL1 as well, perhaps after adjusting the `DISPLAY` value. | |
# | |
# Based off this bash script: https://askubuntu.com/questions/815327/running-gnome-keyring-on-wsl-windows-subsystem-for-linux | |
# Tested and working with `aws-vault` and `jetbrains-toolbox`. | |
# | |
# Be sure your x server is running!!! | |
set -x DISPLAY (cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 | |
pgrep dbus-daemon > /dev/null | |
if test $status -eq 1 | |
dbus-launch --sh-syntax | read --line bus_address ignored bus_pid bus_windowid | |
set -Ux DBUS_SESSION_BUS_ADDRESS (string match -r "'(.*)'" $bus_address)[2] | |
set -Ux DBUS_SESSION_BUS_ID (string match -r "=(.*);" $bus_pid)[2] | |
set -Ux DBUS_SESSION_BUS_WINDOWID (string match -r "=(.*);" $bus_windowid)[2] | |
end | |
# pgrep limited to 15 chars, so truncate `daemon` | |
pgrep gnome-keyring-d > /dev/null | |
if test $status -eq 1 | |
gnome-keyring-daemon | read --line gnome_keyring_control ssh_auth_sock | |
set -Ux GNOME_KEYRING_CONTROL (string split -m 1 = $gnome_keyring_control)[2] | |
set -Ux SSH_AUTH_SOCK (string split -m 1 = $ssh_auth_sock)[2] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I start Sway directly from the console with no display manager. I start Gnome Keyring Daemon with a systemd user unit that ships with the Arch Linux
gnome-keyring
package.To set the environment variables, I have this in
~/.config/fish/config.d/999-sway.fish
: