Skip to content

Instantly share code, notes, and snippets.

@rfc1459
Created September 9, 2014 10:19
Show Gist options
  • Save rfc1459/8885630a7dd562da9f1c to your computer and use it in GitHub Desktop.
Save rfc1459/8885630a7dd562da9f1c to your computer and use it in GitHub Desktop.
Stupid wrapper for gnome-keyring-daemon on MATE 1.8 and XFCE4
#!/usr/bin/env python
# Stupid workaround for a stupid problem: both MATE 1.8 and XFCE4 start
# gnome-keyring-daemon with *ALL* components enabled because gkd sets env
# vars through a GNOME-only DBus interface (org.gnome.SettingsDaemon.Setenv)
# This script wraps gkd and upon detection of the hardcoded command line
# replaces it with a saner one.
# Drop the script as "gnome-keyring-daemon" somewhere higher up in your PATH
# (possibly ~/bin or ~/.local/bin, depending on your profile)
import os
import sys
gkd_path = '/usr/bin/gnome-keyring-daemon'
args = [gkd_path]
if len(sys.argv) == 2 and sys.argv[1] == '--start':
# Ok, we're being called by mate-session-manager or xfce-session, do our magic
# Get rid of gpg and ssh integration, start only PKCS#11 and password management
args.extend(['--start', '--components=pkcs11,secrets'])
else:
# Simple passthrough
args.extend(sys.argv[1:])
# Here we go - make damn sure to preserve the original environment!
os.execve(gkd_path, args, os.environ)
# TODO: handle failure scenarios
sys.exit(1)
@sebastianw
Copy link

Thanks. This wrapper made my day better. If anyone wants a reason why Linux is not gaining grounds on Desktop/Laptop environments, this is one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment