1Password Shortcuts on Wayland

Savanni
edited September 2021 in Linux

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.

Gnome Shell

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.

Next, select Customize Shortcuts

Your list of custom shortcuts may start empty, but you will want to get to something like this:

Press the + 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.

Name Command Shortcut
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

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

KDE Plasma

coming soon

Comments

  • JoeVandelay
    JoeVandelay
    Community Member

    I need to change this:
    Open Quick Access 1password --quick-access Ctrl + Shift + Space

    on KDE Plasma.

    Guys, you can't just start to mess with peoples shortcuts without a way to disable it. Who thought this was a good idea!?

    Big no, no, no, no!

    I'm running a mouseless tiling setup and this breaks everything without warning...

  • Hi @JoeVandelay,

    sorry to hear about this issue. Can you tell us a little more about how this arose?

    The reason I ask is that this new functionality allows you to customize the shortcuts to nearly anything you want - for example the Ctrl + Shift + Space to open Quick Access can be changed to Ctrl + Shift +S, or any other number of shortcuts you choose.

    Also, these are user-determined shortcuts, so you don't have to set up any in Wayland if you don't want to.

    Apologies in advance if I'm misunderstanding something. No matter what, we want to make sure 1Password works with your setup, in the way that works best for you. 👍

  • JoeVandelay
    JoeVandelay
    Community Member

    So whenever I press ctrl+shift+space quick access opens.

    There is no option in 1Password itself to change the shortcut or disable it. There is no option in KDE's (xwindow) Shortcuts to change it. So I don't know how to fix it. Except go grep-ing through dotfiles, what I don't want to do just to get my workflow back

    I'm using KDE plasma without Wayland (because of Nvidia drivers)

    I like the idea of quick access. But new features need a disable toggle

  • JoeVandelay
    JoeVandelay
    Community Member

    To be clear, I didn't add those, it did it by default

    The following is the 1Password defaults set on other platforms, and on XOrg-based displays.

  • JoeVandelay
    JoeVandelay
    Community Member

    The following is the 1Password defaults set on other platforms, and on XOrg-based displays.

    Thanks for the quick fix. Beta is not Alpha and un-askes changes to user environment should not leak

  • Hi, @JoeVandelay. The current beta added the ability to edit shortcuts in 8.2.2-19, and the ability to clear the shortcuts in 8.2.2-23. Those features did not make it into the latest stable release.

  • ad94c
    ad94c
    Community Member

    I'm running 1password 8.4.1 in Fedora 35 with "1password --enable-features=UseOzonePlatform --ozone-platform=wayland"
    when first quick access launch fine but second makes 1password app crash with this error:

    [25769:1206/173556.083974:ERROR:wayland_event_watcher.cc(242)] Fatal Wayland protocol error 0 on interface wl_surface (object 50). Shutting down..

  • jmanes
    jmanes
    Community Member
    edited January 2022

    The 1password command does not seem present for me using Flatpak. I changed the keybinding to invoke the following instead:

    flatpak run com.onepassword.OnePassword --quick-access

    This renders the same result. Thanks for adding this feature!

  • Goldgamer
    Goldgamer
    Community Member

    Is there any news on bringing Full Wayland support for Linux please?
    I would really like to uninstall XWayland since it's working pretty bad with modern hard- software.

  • @Goldgamer We ran into trouble (an inexplicable crash) last month with a version of electron that was supposed to have full Wayland support. I had to table things for a bit and haven't had the chance to get back.

  • Goldgamer
    Goldgamer
    Community Member

    @Savanni all right
    Let’s hope that it will work soon 🤞🏻

  • tunix
    tunix
    Community Member

    I came here to report that quick access was acting strangely (on Fedora Silverblue 35) and found out about this post. :) Thank you for the clarification.

    I believe 1Password (I'm using the flatpak version btw) can detect whether it's working on wayland and direct us to the settings of the DE? (I don't know what that would be for sway -- maybe at least the app can state the fact and save us from visiting the forum?)

  • Yeah, that should be pretty easy, I just need time to put it in. In an ideal world, we could detect it at startup and automatically choose the Wayland renderer, as well. But right now, the Wayland renderer for Electron always crashes on our machines.

  • noahtallen
    noahtallen
    Community Member

    Echoing support for this issue. I have to use a 1.5x scaling factor in Wayland, and XWayland apps don't work well with that -- the text is very fuzzy! Running electron apps in Wayland solves the blurry text issue.

    Interestingly, 1Password does render pretty well for me in Wayland using v8.7.0 (on Fedora 36 with Sway). I just copied the 1password.desktop file from /usr/share/applications to ~/.local/share/applications, and set the Exec line to Exec=/opt/1Password/1password --enable-features=UseOzonePlatform --ozone-platform=wayland %U. With this change, both the main 1Password window and the quick access menu both render at high DPI without fuzzy text.

    I've not experienced any crashes yet, though I do have a few issues:
    1. When opening a new 1Password window on a workspace with a window open, there is a large empty area at the top -- about 200px? This doesn't happen on a blank workspace, where 1Password can fill the screen, just on a workspace where it's split to only part of the screen. Setting it to float also avoids the problem.
    2. Quick Access actually renders fine, it's just that the shortcut only works every other time. Ctrl-Shift-Space opens it, Esc closes it, Ctrl-Shift-Space does nothing, but Ctrl-Shift-Space once more opens it. So effectively, the shortcut becomes Ctrl-Shift and then tap space twice. :P
    3. Copy/pasting out of the main 1Password app (or quick access) doesn't work at all. At the very least, the values aren't copied to the global clipboard. So if I use the shortcut or click "copy value," nothing gets pasted into other apps like Firefox.

    Thankfully copy/pasting in the 1Password browser extension works great :)

This discussion has been closed.