Hyprland with Gnome Keyring

Hyprland is just awesome, but some apps like MongoDB Compass shows warning like “cannot access credential storage”. It’s because it cannot find the credential manager that responsible to store sensitive information like passwords.

We can solve the problem by installing gnome-keyring via package manager like pacman or yay then add these lines below to hyprland.conf.

env = XDG_CURRENT_DESKTOP,GNOME
exec-once = /usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh

This method works nice but shows warning right after boot on the top right corner of the screen. The warning is because we override the XDG_CURRENT_DESKTOP variable. I ignored the warning for period of time because I found there is nothing happening until I started to share my screen in Google Meet and realized that I can’t do it now.

When I tried to share my screen in Google Meet it showed error like my organization is probably blocking access or whatever. Then I tried using Screego and it showed “Could not start presentation. (getDisplayMedia error). NotAllowedError: The request is not allowed by the user agent or the platform in the current context.” I restarted my Hyprland and even my laptop and it still does not work.

Then I tried to remove env = XDG_CURRENT_DESKTOP,GNOME from my hyprland.conf and it works. But now the MongoDB Compass showed the credential warning again. So to make it opens without warning the env value of XDG_CURRENT_DESKTOP should be set to GNOME.

To set the env without conflicting with hyprland we can set it by appending to the command that start the MongoDB Compass. The desktop shortcut is located at /usr/share/applications/mongodb-compass.desktop, and I added a little modification on Exec field.

[Desktop Entry]
Name=MongoDB Compass
Comment=The MongoDB GUI
GenericName=MongoDB Compass
Exec=env XDG_CURRENT_DESKTOP=GNOME mongodb-compass %U --ignore-additional-command-line-flags --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations
Icon=mongodb-compass
Type=Application
StartupNotify=true
Categories=Office;Database;Building;Debugger;IDE;GUIDesigner;Profiling;
MimeType=x-scheme-handler/mongodb;x-scheme-handler/mongodb+srv;

So by simply appending env XDG_CURRENT_DESKTOP=GNOME before the mongodb-compass command we set the env right before it runs. This method can be used to other apps that requires Gnome Keyring too.

That’s it, thanks for reading…