Keepassxc: Perform autotype doesn't work in i3 window manager

Created on 1 Apr 2017  路  17Comments  路  Source: keepassxreboot/keepassxc

It seems like in i3, "perform autotype" doesn't work. This has been the case ever since I upgraded to Keepass2.

Expected Behavior

  1. Press the perform autotype hotkey (Ctrl+V)
  2. Keepass switches to previous active window and fills in username/password

Current Behavior

  1. Press the perform autotype hotkey (Ctrl+V)
  2. Keepass either does nothing, or tries filling in the username/password inside Keepass itself

Your Environment

Installed from the .deb file on github releases.

  • KeePassXC version/commit used: 2.1.3, commit 76dcfb5ed0c874f6a835ef0347ddf6098b149e9b
  • Qt version: 5.7.1
  • Operating System and version: Debian 9/Stretch

Most helpful comment

I'm also using i3 (on Arch Linux). This way autotype seems to work (using Ctrl+V shortcut or context menu):

  • set all three system tray options in Tools -> Settings -> Basic Settings ("Show a system tray icon" and "Hide window ...")
  • at least once minimize to tray or quit KeePassXC

All 17 comments

What is i3? This needs more information.

Ah, my bad. i3 is a window manager for X11 in Linux, comparable to AwesomeWM or Openbox, and to some degree Gnome and KDE. https://i3wm.org/

Interesting, they claim to use the xcb interface as well. This will have to be run through a debugger.

Have you tried using the global autotype shortcut feature?

Global autotype works.

This will have to be run through a debugger.

Is this something I can help with?

Perhaps, but please wait for v2.2.0 coming out this weekend. This may be fixed.

Upgraded to 2.2.0 and the problem still seems to be the same.

In _global autotype_ the active window id is stored while pressing the hotkey.
Before the autotype sequence starts keepassx raises the window with that stored id.

In opposite _perform autotype_ just minimizes keepassx window and starts autotype.
https://github.com/keepassxreboot/keepassxc/blob/079e383319ffb95b804610525012c1d3e7f5ea0e/src/autotype/AutoType.cpp#L161

Probably hideWindow->showMinimized(); doesn't work as expected with i3.
This is also an issue with mac os.

I'd still be interested to know if there's anything I can do to help with this issue.

Besides running it through the debugger and fixing the code that's broken? Not much

Is there information on how to run it through "the debugger" (not sure what this is referring to) somewhere?

Not really, if you are not a programmer you won't be able to diagnose this issue without extensive assistance.

I am a programmer, I just very rarely work with C. I don't really need extensive help, but some hints would be nice. I would at least want to try and give it a shot.

Should I be using gdb or something else? Do I need to compile with debug flags on, and if so, how? Should I be inserting breakpoints using gdb and step through what's happening that way or what do you think the best approach would be?

Great! When you compile make sure you use "CMAKE_BUILD_TYPE=Debug" flag to enable debugging. After it's compiled you'll want to: gdb src/keepassxc.exe which will begin the debug session. Set a breakpoint at the perform autotype function by typing b DatabaseWidget.cpp:532 then run the program with r. Once running issue the CTRL+V shortcut and you should break right before the autotype code is called then you can follow along with gdb commands to see where the breakdown occurs.

Note: these instructions are off-the-cuff and may not work (ie I didn't test them)

Great, thanks! I will spend at least an hour or two this weekend trying this out.

This took me way longer to get around to than I thought, sorry about that. I think I compiled with debug etc. correctly:

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/opt/keepassxc -DWITH_GUI_TESTS=ON ..

But I think I'm missing something, as I'm not able to step into the hideMinimized function.

(gdb) b AutoType.cpp:156
Breakpoint 1 at 0x12537d: file /home/andreas/code/keepassxc/src/autotype/AutoType.cpp, line 156.
(gdb) r
Starting program: /home/andreas/code/keepassxc/build/src/keepassxc 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffebd27700 (LWP 561)]
[New Thread 0x7fffeae3e700 (LWP 562)]
[New Thread 0x7fffe3fff700 (LWP 567)]

Thread 1 "keepassxc" hit Breakpoint 1, AutoType::performAutoType (this=0x555555b28d80, entry=0x555556393ab0, hideWindow=0x7fffffffe6b0, customSequence=..., window=0)
    at /home/andreas/code/keepassxc/src/autotype/AutoType.cpp:157
157     if (hideWindow) {
(gdb) s
161         hideWindow->showMinimized();
(gdb) s
165     Tools::wait(m_plugin->initialTimeout());
(gdb)

In the process of testing I did find out a few more interesting things, though. showMinimized does minimize the window, but only if I enable the system tray icon and enable the "close to tray when minimized" setting. I have to imagine this is because i3 does not really have a concept of minimizing things. Now, I am only confused as to why it worked in Keepassx version 1 (or 0, can't remember which it was), and if it's possible to replicate whatever that code did to switch window focus.

I'm also using i3 (on Arch Linux). This way autotype seems to work (using Ctrl+V shortcut or context menu):

  • set all three system tray options in Tools -> Settings -> Basic Settings ("Show a system tray icon" and "Hide window ...")
  • at least once minimize to tray or quit KeePassXC
Was this page helpful?
0 / 5 - 0 ratings