Skip to content

Instantly share code, notes, and snippets.

@gene-pavlovsky
Last active March 27, 2023 19:43
Show Gist options
  • Save gene-pavlovsky/97da0fa85bbf323fb8b0716991f1d558 to your computer and use it in GitHub Desktop.
Save gene-pavlovsky/97da0fa85bbf323fb8b0716991f1d558 to your computer and use it in GitHub Desktop.
EnvGet, ProgramFiles32, ProgramFiles(x86)
EnvGet, ProgramFiles64, ProgramFiles
if (!ProgramFiles32)
ProgramFiles32 := ProgramFiles64
; ************************************************************************************************************************************************************
; Run/show/hide KeePassXC using Win+K
;
#k::
if (WinExist("ahk_exe KeePassXC.exe") && WinActive("ahk_exe KeePassXC.exe"))
WinMinimize
else
Run % ProgramFiles64 . "\KeePassXC\KeePassXC.exe"
return
@CerebralFreeze
Copy link

Gene,

To be honest, I'm a newb programmer so I don't know what the beginning section does or how the variables get defined later. So, I just wrote it the simple beginner way. You can change it back if you want. I just didn't know how to correct it.

Just to let you know, I haven't had any issues with active/restore after "minimize to tray" option was activated. So, I'm speculating the problem is related to the expert method you used.

Anyway, thanks again for the script. I appreciate it.

Enjoy the weekend!

@valner88
Copy link

What does this ahk script do??

@gene-pavlovsky
Copy link
Author

gene-pavlovsky commented Sep 14, 2021

@valner88 What is described in the comment on line 7 - runs, shows or hides KeePassXC (depending on it's current state), when you press Windows key and K simultaneously.

Similar to how (on Windows 7+) you can run/show/hide an app pinned to your taskbar by using Windows key and a corresponding digit 1-9.

I use various other similar shortcuts to make it quick to switch between commonly used apps. Some apps that hide to tray on minimize are a bit more tricky to unhide (WinExist returns false for the hidden window, you have to use some options like detect hidden windows etc), KeePassXC is actually one of them, I had a script that worked for a while but stopped working with another KeePassXC update, in the end I gave up and just disable the hide to tray option in it's settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment