Created
September 12, 2015 18:33
-
-
Save jkpl/01226bfc7006e920a631 to your computer and use it in GitHub Desktop.
Script for showing/hiding KeepassX window. Bind to a global shortcut for max power.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
function xdokeepassx { | |
xdotool search --maxdepth 3 --classname keepassx $@ | |
} | |
function show_keepassx { | |
local desktop="`xdotool get_desktop`" | |
xdokeepassx \ | |
set_desktop_for_window %@ $desktop \ | |
windowactivate %@ \ | |
> /dev/null 2>&1 | |
} | |
function hide_keepassx { | |
xdokeepassx windowminimize %@ > /dev/null 2>&1 | |
} | |
function is_keepassx_shown { | |
local active_id="`xdotool getactivewindow`" | |
xdokeepassx | grep -F $active_id > /dev/null 2>&1 | |
} | |
if is_keepassx_shown; then | |
hide_keepassx | |
else | |
show_keepassx | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment