aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorFrederic Crozat <fcrozat@mandriva.com>2005-03-09 13:43:42 +0000
committerFrederic Crozat <fcrozat@mandriva.com>2005-03-09 13:43:42 +0000
commit344980f597e76f46ddb33d3f5eee528b1fa98415 (patch)
treed51075fd63ab8f87313b3ad20d6dca732b0d702e /bin
parent486becf30a7d063e97993629b6d1adeecdaf1c48 (diff)
downloadcommon-data-344980f597e76f46ddb33d3f5eee528b1fa98415.tar
common-data-344980f597e76f46ddb33d3f5eee528b1fa98415.tar.gz
common-data-344980f597e76f46ddb33d3f5eee528b1fa98415.tar.bz2
common-data-344980f597e76f46ddb33d3f5eee528b1fa98415.tar.xz
common-data-344980f597e76f46ddb33d3f5eee528b1fa98415.zip
- change www-browser to use BROWSER variable if set or use running environment
settings if set. - xvt script to replace alternative : choose programs to start based on running environment
Diffstat (limited to 'bin')
-rwxr-xr-xbin/www-browser42
-rwxr-xr-xbin/xvt57
2 files changed, 93 insertions, 6 deletions
diff --git a/bin/www-browser b/bin/www-browser
index 7575b84..2e8e1ae 100755
--- a/bin/www-browser
+++ b/bin/www-browser
@@ -9,18 +9,48 @@
# Purpose : launch a web browser
#---------------------------------------------------------------
+strip_browser_var() {
+if [[ -n "$BROWSER" ]]; then
+ if [[ `basename "$BROWSER"` == "www-browser" ]]; then
+ unset BROWSER
+ fi
+fi
+}
+
+strip_browser_var
if [[ -z "$BROWSER" ]]; then
- if /sbin/pidof gnome-session > /dev/null; then
- BROWSER=`which epiphany 2> /dev/null`
- [[ -z "$BROWSER" ]] && BROWSER=`which galeon 2> /dev/null`
+
+ # using GNOME
+ if [[ -n "$GNOME_DESKTOP_SESSION_ID" ]]; then
+ BROWSER=`gconftool -g /desktop/gnome/url-handlers/http/command | sed -e 's/%s//'`
+ if [[ `gconftool -g /desktop/gnome/url-handlers/http/needs_terminal` == "true" ]]; then
+ BROWSER="xvt -e $BROWSER"
+ fi
fi
- [[ -z "$BROWSER" ]] && which kfmclient 2> /dev/null && BROWSER="kfmclient openProfile webbrowsing"
+
+ #using KDE
+ if [[ -n "$KDE_FULL_SESSION" ]]; then
+ NEWBROWSER=`grep -m 1 'BrowserApplication=' $HOME/.kde/share/config/kdeglobals 2>/dev/null`
+ [[ -z "$NEWBROWSER" ]] && NEWBROWSER=`grep -m 1 'BrowserApplication=' /etc/kde/kdeglobals 2>/dev/null`
+ if [[ -n "$NEWBROWSER" ]]; then
+ BROWSER=`echo $NEWBROWSER | sed -e 's/BrowserApplication=//' -e 's/!//'`
+ fi
+ [[ -z "$BROWSER" ]] && which kfmclient 2> /dev/null && BROWSER="kfmclient openProfile webbrowsing"
+ fi
+
+ strip_browser_var
+
+ [[ -z "$BROWSER" ]] && BROWSER=`which mozilla-firefox 2> /dev/null`
[[ -z "$BROWSER" ]] && BROWSER=`which epiphany 2> /dev/null`
[[ -z "$BROWSER" ]] && BROWSER=`which galeon 2> /dev/null`
[[ -z "$BROWSER" ]] && BROWSER=`which mozilla 2> /dev/null`
+ [[ -z "$BROWSER" ]] && which kfmclient 2> /dev/null && BROWSER="kfmclient openProfile webbrowsing"
fi
-echo "$BROWSER $@"
-exec $BROWSER "$@"
+if [[ -n "$BROWSER" ]]; then
+ exec $BROWSER "$@"
+else
+ echo "no web browser detected"
+fi
# www-browser ends here
diff --git a/bin/xvt b/bin/xvt
new file mode 100755
index 0000000..b619da9
--- /dev/null
+++ b/bin/xvt
@@ -0,0 +1,57 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project : Mandrakelinux
+# Module : bin
+# File : xvt
+# Version : $Id$
+# Author : Frederic Lepied
+# Created On : Tue Aug 31 16:26:54 2004
+# Purpose : launch a terminal emulator
+#---------------------------------------------------------------
+
+strip_terminal_var() {
+if [[ -n "$TERMINAL" ]]; then
+ if [[ `basename "$TERMINAL"` == "xvt" ]]; then
+ unset TERMINAL
+ fi
+fi
+}
+
+strip_terminal_var
+if [[ -z "$TERMINAL" ]]; then
+
+ # using GNOME
+ if [[ -n "$GNOME_DESKTOP_SESSION_ID" ]]; then
+ TERMINAL=`gconftool -g /desktop/gnome/applications/terminal/exec`
+ fi
+
+ #using KDE
+ if [[ -n "$KDE_FULL_SESSION" ]]; then
+ NEWTERMINAL=`grep -m 1 'TerminalApplication=' $HOME/.kde/share/config/kdeglobals 2>/dev/null`
+ [[ -z "$NEWTERMINAL" ]] && NEWTERMINAL=`grep -m 1 'TerminalApplication=' /etc/kde/kdeglobals 2>/dev/null`
+ if [[ -n "$NEWTERMINAL" ]]; then
+ TERMINAL=`echo $NEWTERMINAL| sed -e 's/TerminalApplication=//' -e 's/!//'`
+ fi
+ [[ -z "$TERMINAL" ]] && which kconsole 2> /dev/null && TERMINAL="konsole"
+ fi
+
+ strip_terminal_var
+
+ [[ -z "$TERMINAL" ]] && TERMINAL=`which rxvt 2> /dev/null`
+ [[ -z "$TERMINAL" ]] && TERMINAL=`which xterm 2> /dev/null`
+ [[ -z "$TERMINAL" ]] && TERMINAL=`which gnome-terminal 2> /dev/null`
+ [[ -z "$TERMINAL" ]] && TERMINAL=`which konsole 2> /dev/null`
+ [[ -z "$TERMINAL" ]] && TERMINAL=`which aterm 2> /dev/null`
+ [[ -z "$TERMINAL" ]] && TERMINAL=`which Eterm 2> /dev/null`
+ [[ -z "$TERMINAL" ]] && TERMINAL=`which kterm 2> /dev/null`
+ [[ -z "$TERMINAL" ]] && TERMINAL=`which multi-gnome-terminal 2> /dev/null`
+ [[ -z "$TERMINAL" ]] && TERMINAL=`which multixterm 2> /dev/null`
+fi
+
+if [[ -n "$TERMINAL" ]]; then
+ exec $TERMINAL "$@"
+else
+ echo "no terminal emulator detected"
+fi
+
+# www-browser ends here