Skip to content

Commit

Permalink
auto disable start w3m under tty
Browse files Browse the repository at this point in the history
  • Loading branch information
xxnet committed Jul 29, 2015
1 parent 4800470 commit f4d8a40
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions launcher/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@
noarch_lib = os.path.abspath( os.path.join(python_path, 'lib', 'noarch'))
sys.path.append(noarch_lib)

has_desktop = True
if sys.platform.startswith("linux"):
def X_is_running():
from subprocess import Popen, PIPE
p = Popen(["xset", "-q"], stdout=PIPE, stderr=PIPE)
p.communicate()
return p.returncode == 0
try:
from subprocess import Popen, PIPE
p = Popen(["xset", "-q"], stdout=PIPE, stderr=PIPE)
p.communicate()
return p.returncode == 0
except:
return False

if X_is_running():
from gtk_tray import sys_tray
else:
from non_tray import sys_tray
has_desktop = False

elif sys.platform == "win32":
win32_lib = os.path.join(python_path, 'lib', 'win32')
Expand All @@ -42,6 +47,7 @@ def X_is_running():
else:
print("detect platform fail:%s" % sys.platform)
from non_tray import sys_tray
has_desktop = False

import config
import web_control
Expand Down Expand Up @@ -77,7 +83,7 @@ def main():
web_control.start()


if config.get(["modules", "launcher", "popup_webui"], 1) == 1:
if has_desktop and config.get(["modules", "launcher", "popup_webui"], 1) == 1:
webbrowser.open("http://127.0.0.1:8085/")

update.start()
Expand Down

0 comments on commit f4d8a40

Please sign in to comment.