1. Set the custom keyboard shortcut sh -c 'pgrep -i keepassxc > /dev/null || keepassxc' to Alt+V
  2. Keep KeePassXC’s default autotype prompt keybinding, which is Alt+V

One disables the other. I thought that going the grep route might make the program opener conditionally inactive, but apparently that’s not doing anything. I would really like to avoid using a separate keybinding if possible. Otherwise, I guess I’d just have to have it open on launch.

  • HelloRoot@lemy.lol
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    19 days ago

    The problem is that your desktop environment’s shortcut handler interceptsAlt+V before KeePassXC ever sees it, so the internal keybinding never fires. And whenpgrep finds the process running, your command simply does nothing.

    The fix is to use KeePassXC’s --auto-type CLI flag, which sends the auto-type signal to a running instance:

    Command for your custom shortcut (Alt+V):

    bash -c 'pgrep -x keepassxc > /dev/null && keepassxc --auto-type || keepassxc'
    

    Not sure what happens when keepass is minimized / in the system tray though

    • Flagstaff@programming.devOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      19 days ago

      Wow, it works; you’re a genius!!! Thanks so much!!! Hmm, Lemmy doesn’t seem to have post flair, but it does allow title-editing, so I’ll just update the post title, haha.

      • HelloRoot@lemy.lol
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        16 days ago

        Yeah you probably have to play around with the flags to figure out the right approach. I can not look into it right now

        • Flagstaff@programming.devOP
          link
          fedilink
          English
          arrow-up
          0
          ·
          1 day ago

          I don’t really understand how to figure out flags, so I just set it to start up on boot and just log in from the start and that basically fixes it.

  • Hettyc_Tracyn@lemmy.zip
    link
    fedilink
    English
    arrow-up
    0
    ·
    19 days ago

    If you use Hyperland, you can simply setup the keybind in hypr.config (also makes it easier to change your default file manager, etc)