Last active
December 26, 2015 20:29
-
-
Save bulletmark/7209358 to your computer and use it in GitHub Desktop.
Hotot startup wrapper.
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/bash | |
# | |
# Simple bash wrapper to ensure hotot app only runs once. Name this | |
# script "hotot", "hotot-gtk3", or "hotot-qt5", etc as appropriate for you and | |
# put early in your PATH, e.g. in your $HOME/bin/. | |
# | |
# Author: Mark Blakeney. | |
prog=$(basename $0) | |
real=/usr/bin/$prog | |
name=${prog%-*} | |
if pgrep -f $real >/dev/null; then | |
# Already running, just make it show .. | |
dbus-send --session --type=method_call --dest=org.$name.service \ | |
/org/$name/service org.$name.service.show | |
exit 0 | |
fi | |
# Otherwise just start it normally .. | |
exec $real |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment