From 0bfbebb21d4989bdabd90580531f9f91d543f865 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 25 Jan 2019 16:36:54 +0530 Subject: [PATCH] gtkstatus is broken, just launch oml for now --- ctl | 10 ++++++---- oml/gtkstatus.py | 14 +++++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ctl b/ctl index 1abac88..4c05511 100755 --- a/ctl +++ b/ctl @@ -162,12 +162,14 @@ if [ "$1" == "open" ]; then xdg-open "file://${BASE}/openmedialibrary/static/html/load.html" fi else - $PYTHON "${NAME}/oml/gtkstatus.py" $@ - exit $? + #$PYTHON "${NAME}/oml/gtkstatus.py" $@ + #exit $? + "$0" start & fi else - $PYTHON "$NAME/oml/gtkstatus.py" $@ - exit $? + #$PYTHON "$NAME/oml/gtkstatus.py" $@ + #exit $? + "$0" start & fi fi exit 0 diff --git a/oml/gtkstatus.py b/oml/gtkstatus.py index 726afc5..d9abb0d 100644 --- a/oml/gtkstatus.py +++ b/oml/gtkstatus.py @@ -22,6 +22,18 @@ title = "Open Media Library" ctl = base + '/ctl' +def check_pid(pid): + if not os.path.exists(pid): + return False + try: + with open(pid, 'r') as fd: + pid = int(fd.read().strip()) + os.kill(pid, 0) + except OSError: + return False + else: + return True + class OMLIcon: menu = None icon = None @@ -81,7 +93,7 @@ class OMLIcon: @classmethod def is_running(cls): pid = cls.get_pid() - if pid and os.path.exists(pid): + if pid and check_pid(pid): return True else: return False