1Password Shortcuts on Wayland
1Password is an application that works very well when users can invoke it from anywhere. Quick Access in particular is a feature that is meant to be invoked from anywhere on your desktop. However, as many of you know, the Wayland developers made a deliberate choice to not allow applications to set global shortcuts. To my knowledge, all Wayland implementations have continued to honor this choice. The reasoning is valid, though: global shortcuts make keyloggers trivial.
1Password can run as a native Wayland application, and defaults to XWayland. This, however, does not help since the primary desktop environment is itself Wayland.
For a variety of reasons, we have provided command line options for several of the most useful 1Password commands. In this article, I'll describe how to use those options to set up global shortcuts for 1Password with both Gnome Shell and Sway. It is, fortunately, very easy.
For this example, I'm running Gnome Shell 40.4.0, Wayland mode, on Fedora Core 34.
Start by finding
Keyboard > Customize Shortcuts in your Settings application.
Your list of custom shortcuts may start empty, but you will want to get to something like this:
+ button at the bottom to create a new shortcut, and you'll get a screen like this:
As you create each shortcut, name each one in a way that makes sense to you. In the
Command field, you will write a trivial script that invokes 1Password with the option that you want. Once you have created that invocation, set the keyboard shortcut as you desire. I recommend multiple key bindings that all work together. The following is the 1Password defaults set on other platforms, and on XOrg-based displays.
|Open or Toggle 1Password||1password --toggle||Ctrl + p|
|Lock 1Password||1password --lock||Ctrl + Shift + L|
|Open Quick Access||1password --quick-access||Ctrl + Shift + Space|
note: there is no default for Open or Toggle 1Password, so I made something up.
Sway does not have a GUI configurator, but instead does everything in the configuration file at
~/.config/sway/config. Fortunately, this is very easy to set up:
bindsym Ctrl+Shift+l 1password --lock byndsym Ctrl+Shift+space exec 1password --quick-access