diff options
Diffstat (limited to 'trunk/bin')
-rw-r--r-- | trunk/bin/print-cups.sh | 10 | ||||
-rwxr-xr-x | trunk/bin/www-browser | 82 | ||||
-rwxr-xr-x | trunk/bin/xvt | 57 |
3 files changed, 149 insertions, 0 deletions
diff --git a/trunk/bin/print-cups.sh b/trunk/bin/print-cups.sh new file mode 100644 index 0000000..230df13 --- /dev/null +++ b/trunk/bin/print-cups.sh @@ -0,0 +1,10 @@ +#!/bin/sh +if [ -x /usr/bin/qtcups ]; then + qtcups $* +else + if [ -x /usr/bin/xpp ]; then + xpp $* + else + lpr $* + fi +fi diff --git a/trunk/bin/www-browser b/trunk/bin/www-browser new file mode 100755 index 0000000..4eb6e51 --- /dev/null +++ b/trunk/bin/www-browser @@ -0,0 +1,82 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandrakelinux +# Module : bin +# File : www-browser +# Version : $Id$ +# Author : Frederic Lepied +# Created On : Tue Aug 31 16:26:54 2004 +# Purpose : launch a web browser +#--------------------------------------------------------------- + +# +# If we got any argument, we can call xdg-open, if we havenĀ“t already done it +# +if [ -n "$*" -a -z "$THROUGHXDG" ]; then + # Lock against bug #29599 + export THROUGHXDG=1 + exec xdg-open "$@" +fi + +# +# No URL specified, so we must find a proper browser for the current env +# + +strip_browser_var() { + if [[ -n "$BROWSER" ]]; then + if [[ `basename "$BROWSER"` == "www-browser" ]]; then + unset BROWSER + else + set $BROWSER + if ! which $1 > /dev/null 2>&1; then + unset BROWSER + fi + fi + fi +} + +strip_browser_var +if [[ -z "$BROWSER" ]]; then + + # 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 + + #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=\(.*\).desktop/\1/'` + BROWSER="dcop klauncher default start_service_by_desktop_name(QString,QStringList) $BROWSER [ ]" + fi + fi + + strip_browser_var + + [[ -z "$BROWSER" ]] && BROWSER=`which mozilla-firefox 2> /dev/null` + [[ -z "$BROWSER" ]] && [[ -n "$KDE_FULL_SESSION" ]] && which kfmclient > /dev/null 2>&1 && BROWSER="kfmclient openProfile webbrowsing" + [[ -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 > /dev/null 2>&1 && BROWSER="kfmclient openProfile webbrowsing" + [[ -z "$BROWSER" ]] && which links > /dev/null 2>&1 && BROWSER="xvt -e links" + [[ -z "$BROWSER" ]] && which lynx > /dev/null 2>&1 && BROWSER="xvt -e lynx" +fi + +if [[ -n "$BROWSER" ]]; then + if [[ -n "$THROUGHXDG" ]]; then + # xdg couldn't handle the url + exec $BROWSER $@ + else + exec $BROWSER + fi +else + echo "no web browser detected" +fi + +# www-browser ends here diff --git a/trunk/bin/xvt b/trunk/bin/xvt new file mode 100755 index 0000000..d380bbc --- /dev/null +++ b/trunk/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 konsole 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 |