naglfar / krunner-keepassxc

A small krunner plugin to copy keepassxc entries to clipboard using its Freedesktop.org Secret Service dbus integration.
MIT License
27 stars 3 forks source link

Add copying of TOTP #13

Closed TheLastZombie closed 2 years ago

TheLastZombie commented 2 years ago

Thanks for this, it makes my workflow a lot easier. However, I often find myself still having to open KeePassXC and searching for the entry I want in order to copy the TOTP. It would be great if I could use, say, Alt + Enter to copy the code.

naglfar commented 2 years ago

Hey, thanks for the feedback and the feature suggestion. I just did a quick test and getting the TOTP from keepassxc itself is actually fairly easy, there's still two problems, though:

  1. the shortcuts for the krunner actions are set through krunner itself, those are not defined by me. So for now we're stuck with two actions: the main one (copy password) and the secondary one (copy user). I don't even know where I found out about shift+enter for the secondary action, probably trial and error since this doesn't seem to be documented anywhere. So a keyboard shortcut for TOTP is no option (for now)
  2. I can add another secondary action that can be clicked on to trigger copying the TOTP, but: I can only supply supported actions whenever krunner asks for them, which is only when a completely new query is started. This means that it's not possible to display the TOTP action only for entries that actually have a TOTP set, it would always show up for all entries and that really sucks.

One option I could think of for now would be adding the TOTP as a separate entry in the result list, it would still have a rather useless secondary username option, but I think this would be the better option. Doing this does however introduce some problems in the current code base I will have to think about.

naglfar commented 2 years ago

Has now been implemented with version 1.8.0, I went with TOTP as separate entries but added an option to the config file if you prefer the other version. Hopefully I can come up with a better solution some time in the future.