Skip to content

Instantly share code, notes, and snippets.

@bulletmark
Last active December 26, 2015 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bulletmark/7209358 to your computer and use it in GitHub Desktop.
Save bulletmark/7209358 to your computer and use it in GitHub Desktop.
Hotot startup wrapper.
#!/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