From c8021221f25f4dd2d82e69688294c114331549bd Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Tue, 5 Nov 2013 22:12:54 +0100 Subject: check if irc client is installed --- usr/share/mageiawelcome/helpers.py | 9 +++++++++ usr/share/mageiawelcome/mageiawelcome.py | 15 +++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/usr/share/mageiawelcome/helpers.py b/usr/share/mageiawelcome/helpers.py index 1ad236b..3695c39 100644 --- a/usr/share/mageiawelcome/helpers.py +++ b/usr/share/mageiawelcome/helpers.py @@ -19,6 +19,15 @@ def get_desktop_name(x): '03WindowMaker':'WindowMaker', '09Fvwm2':'Fvwm2', }.get(x,'Other') + +def get_irc_client(): + if os.path.exists("/usr/bin/hexchat"): irc_client = "/usr/bin/hexchat &" + elif os.path.exists("/usr/bin/xchat-gnome"): irc_client = "/usr/bin/xchat-gnome &" + elif os.path.exists("/usr/bin/xchat"): irc_client = "/usr/bin/xchat &" + elif os.path.exists("/usr/bin/konversation"): irc_client = "/usr/bin/konversation &" + elif os.path.exists("/usr/bin/quassel"): irc_client = "/usr/bin/quassel &" + else: irc_client = "none" + return irc_client def is_installed(name): return os.WEXITSTATUS(os.system('rpm -q --quiet ' + name)) diff --git a/usr/share/mageiawelcome/mageiawelcome.py b/usr/share/mageiawelcome/mageiawelcome.py index 3899859..374cd32 100644 --- a/usr/share/mageiawelcome/mageiawelcome.py +++ b/usr/share/mageiawelcome/mageiawelcome.py @@ -126,14 +126,13 @@ def main(): elif msg.startswith("http"): os.system("xdg-open " + msg) elif msg == "irc": - if os.path.exists("/usr/bin/xchat-gnome"): - os.system("/usr/bin/xchat-gnome &") - elif os.path.exists("/usr/bin/xchat"): - os.system("/usr/bin/xchat &") - elif os.path.exists("/usr/bin/konversation"): - os.system("/usr/bin/konversation &") - elif os.path.exists("/usr/bin/quassel"): - os.system("/usr/bin/quassel &") + irc_client = get_irc_client() + if irc_client == "none": + if desktop == "KDE": + subprocess.Popen("gurpmi konversation", shell=True) + else: + subprocess.Popen("gurpmi hexchat", shell=True) + else: os.system(irc_client) elif msg.startswith("run"): args = shlex.split(msg) args.pop(0) -- cgit v1.2.1