NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.28k stars 14.26k forks source link

keepassxc: Auto-Type feature not available #94715

Open mythsunwind opened 4 years ago

mythsunwind commented 4 years ago

Describe the bug The feature to auto-type in a password is not working on 2.6.0 version of keepassxc on macOS. I also saw the issue with the a former version 2.5.x.

To Reproduce Steps to reproduce the behavior:

  1. Open or create a db
  2. Add new entry with user and password and enable Auto-Type for this entry
  3. Select new entry in list
  4. Check Auto-Type tab or right click and search for Auto-Type menu item

Auto-Type tab is greyed out and disabled. No menu item.

Expected behavior There should be a menu item for auto-type on the entry and also an Auto-Type tab on the bottom of keepassxc. None of them exist, even though the extension is enabled according to the debug info (see below).

Screenshots

Screenshot 2020-08-05 at 17 26 00

More info cmake contains flag to build auto-type feature with -DWITH_XC_AUTOTYPE=ON. I can attach full build log if needed.

Keepassxc debug info KeePassXC - Version 2.6.0

Qt 5.12.7 Debugging mode is disabled.

Operating system: macOS 10.15 CPU architecture: x86_64 Kernel: darwin 19.5.0

Enabled extensions:

Cryptographic libraries: libgcrypt 1.8.6

Notify maintainers @jonafato @turion

Metadata $ nix-shell -p nix-info --run "nix-info -m"

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
flokli commented 4 years ago

cc @NixOS/darwin-maintainers

turion commented 4 years ago

Can you somehow rule out an upstream bug?

mythsunwind commented 4 years ago

Can you somehow rule out an upstream bug?

Yes, I would say it is not an upstream bug because it did not work in 2.5.4 for me and I found a bug ticket on upstream which shows that selecting auto-type from the right-click menu worked for 2.5.4 on macOS Catalina (the macOS version i use) for upstream users:

https://github.com/keepassxreboot/keepassxc/issues/4586

mythsunwind commented 4 years ago

I checked again and the issue still exists on 2.6.1 in the nix package but upstream version of 2.6.1 is fine.

Additionally the nix version of keepassxc 2.6.1 renders parts of the Qt UI with black icons on a black background now :(

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

turion commented 3 years ago

@mythsunwind

I cannot reproduce this on my machine. Auto-type works for me. My system:

Possibly you could try to update your system and see whether bug persists? Also, what window manager do you use? Are you in KDE?

I believe that this is not a specific bug in keepassxc, but rather in the nixpkgs-Qt story in general. There have been bugs in the past with Qt introducing state in home directories and whatnot. Perhaps @ttuegel can share his wisdom what to look out for?

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

ljubitje commented 1 week ago

This bug is ongoing with KeePassXC 2.7.9 on KDE Plasma 6.2.2. No Auto-Type settings tab is shown and autotype does not work. I think it is because of some Wayland limitation.

I have found and tested 3 workarounds, as per KeePassXC docs. They all force the app to relay on X11 instead of Wayland.

Solution 1: Start KeePassXC from terminal with -platform xcb flag. Full command is simply: keepassxc -platform xcb

Solution 2: Install KeePassXC as a Flatpak. (How to enable Flatpaks is below the picture.) Open (KDE Plasma) System Settings -> Application Permissions -> Flatpak Permissions -> KeePassXC -> Advanced Permissions -> Sockets Disable (untick) Wayland windowing system. Click Apply and restart KeePassXC.

Solution 3: Install KeePassXC as a Flatpak. (How to enable Flatpaks is below the picture.) Open (KDE Plasma) System Settings -> Application Permissions -> Flatpak Permissions -> KeePassXC -> Advanced Permissions -> (on bottom) Environment -> Add New Set Name exactly: QT_QPA_PLATFORM Set Value exactly: xcb Click Apply and restart KeePassXC.

Flatpak workarounds work on other distros also! I tested on Debian Bookworm. If not on KDE Plasma, download and use Flatseal to set advanced Flatpak permissions on your system.

KeePassXCWaylandWorkaroundSolutionFixFlatpak

How to enable Flatpak on NixOS: Simplest and reproducible way is to configure flake.nix as per https://github.com/gmodena/nix-flatpak:

{
  inputs = {
    # ...
    nix-flatpak.url = "github:gmodena/nix-flatpak"; # unstable branch. Use github:gmodena/nix-flatpak/?ref=<tag> to pin releases.
  };
  outputs = { nix-flatpak, ... }: {
    nixosConfigurations.<host> = nixpkgs.lib.nixosSystem {
      modules = [
        nix-flatpak.nixosModules.nix-flatpak
        ./configuration.nix
      ];
    };
  };
}

Then add this to your configuration.nix:

  # FLATPAK
  services.flatpak.enable = true;
  services.flatpak.update.onActivation = true; # updates flatpaks at nixos-rebuild
  services.flatpak.update.auto.enable = true;
  services.flatpak.update.auto.onCalendar = "7d";
  # PACKAGES
  services.flatpak.packages = [
    "org.keepassxc.KeePassXC"
    # here you can declare other flatpaks to install
  ];

Run nixos-rebuild switch, and you're done!

Extra: If you want a GUI package store, search for kde.Packages.discover and nix-software-center.

ljubitje commented 1 week ago

No matter which workaround the user picks, it does not make a reproducible system because it requires manual intervention after installation. Furthermore, this is another app where I ended up using the Flatpak version instead of the native nixpkgs because of a broken feature and more integrated workaround.

Can you please attempt to enable auto-type feature by setting cmake build flag -DWITH_XC_AUTOTYPE=ON as @mythsunwind suggested, if that is still a valid flag of course? Or consider finding a solution with QT_QPA_PLATFORM=xcb or platform -xcb.

I am also interested in any other easily-reproducible solutions!

I hope I was of help and a fix will be implemented. Thanks and all best, Klemen