Skip to content

Commit

Permalink
Try to figure the desktop type when launching a browser under X Window.
Browse files Browse the repository at this point in the history
git-svn-id: svn://cherokee-project.com/cherokee/trunk@6108 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Jan 14, 2011
1 parent f341a5b commit e8b20f0
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions cherokee/cherokee-admin-launcher
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ def find_sudo_askpass():
return askpass_bin

# X-Window
X_display = os.getenv ("DISPLAY")
if X_display:
# GNOME
def check_gnome():
gaskpass_bin = bin_in_path ('gaskpass')
if gaskpass_bin:
return gaskpass_bin
Expand All @@ -93,7 +91,7 @@ def find_sudo_askpass():
if gnome_ssh_askpass_bin:
return gnome_ssh_askpass_bin

# KDE
def check_kde():
ksshaskpass_bin = bin_in_path ('ksshaskpass')
if ksshaskpass_bin:
return ksshaskpass_bin
Expand All @@ -102,6 +100,24 @@ def find_sudo_askpass():
if kwalletaskpass_bin:
return kwalletaskpass_bin

X_display = os.getenv ("DISPLAY")
if X_display:
ps = os.popen ("ps ax").read().lower()
procs_gnome = ps.count("gnome")
procs_kde = ps.count("kde")

# GNOME and KDE
if procs_gnome > procs_kde:
bin = check_gnome()
if bin: return bin
bin = check_kde()
if bin: return bin
else:
bin = check_kde()
if bin: return bin
bin = check_gnome()
if bin: return bin

# GTK+
gtk_led_askpass_bin = bin_in_path ('gtk-led-askpass')
if gtk_led_askpass_bin:
Expand Down Expand Up @@ -147,8 +163,6 @@ def run_as_root (cmd):


class Admin_Runner (threading.Thread):
# launching_lock = threading.Lock()

def __init__ (self, event_launched):
threading.Thread.__init__ (self)
self.daemon = True
Expand Down

0 comments on commit e8b20f0

Please sign in to comment.