OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 #--------------------------------------------- | 2 #--------------------------------------------- |
3 # xdg-desktop-menu | 3 # xdg-desktop-menu |
4 # | 4 # |
5 # Utility script to install menu items on a Linux desktop. | 5 # Utility script to install menu items on a Linux desktop. |
6 # Refer to the usage() function below for usage. | 6 # Refer to the usage() function below for usage. |
7 # | 7 # |
8 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> | 8 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> |
9 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> | 9 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> |
10 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> | 10 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 # All output to stderr | 593 # All output to stderr |
594 xdg_redirect_output=" >&2" | 594 xdg_redirect_output=" >&2" |
595 fi | 595 fi |
596 | 596 |
597 #-------------------------------------- | 597 #-------------------------------------- |
598 # Checks for known desktop environments | 598 # Checks for known desktop environments |
599 # set variable DE to the desktop environments name, lowercase | 599 # set variable DE to the desktop environments name, lowercase |
600 | 600 |
601 detectDE() | 601 detectDE() |
602 { | 602 { |
| 603 # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 |
| 604 unset GREP_OPTIONS |
| 605 |
603 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 606 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
604 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 607 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; |
605 elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/D
Bus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/nul
l 2>&1` ; then DE=gnome; | 608 elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/D
Bus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/nul
l 2>&1` ; then DE=gnome; |
606 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 609 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
| 610 elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>
&1; then DE=xfce |
607 fi | 611 fi |
608 | 612 |
609 if [ x"$DE" = x"" ]; then | 613 if [ x"$DE" = x"" ]; then |
610 # fallback to checking $DESKTOP_SESSION | 614 # fallback to checking $DESKTOP_SESSION |
611 case "$DESKTOP_SESSION" in | 615 case "$DESKTOP_SESSION" in |
| 616 gnome) |
| 617 DE=gnome; |
612 LXDE) | 618 LXDE) |
613 DE=lxde; | 619 DE=lxde; |
614 ;; | 620 ;; |
615 xfce|xfce4) | 621 xfce|xfce4) |
616 DE=xfce; | 622 DE=xfce; |
617 ;; | 623 ;; |
618 esac | 624 esac |
619 fi | 625 fi |
620 | 626 |
621 if [ x"$DE" = x"" ]; then | 627 if [ x"$DE" = x"" ]; then |
(...skipping 12 matching lines...) Expand all Loading... |
634 fi | 640 fi |
635 } | 641 } |
636 | 642 |
637 #---------------------------------------------------------------------------- | 643 #---------------------------------------------------------------------------- |
638 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 644 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
639 # It also always returns 1 in KDE 3.4 and earlier | 645 # It also always returns 1 in KDE 3.4 and earlier |
640 # Simply return 0 in such case | 646 # Simply return 0 in such case |
641 | 647 |
642 kfmclient_fix_exit_code() | 648 kfmclient_fix_exit_code() |
643 { | 649 { |
644 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; | |
645 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` | 650 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
646 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` | 651 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
647 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` | 652 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
648 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 653 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
649 test "$major" -gt 3 && return $1 | 654 test "$major" -gt 3 && return $1 |
650 test "$minor" -gt 5 && return $1 | 655 test "$minor" -gt 5 && return $1 |
651 test "$release" -gt 4 && return $1 | 656 test "$release" -gt 4 && return $1 |
652 return 0 | 657 return 0 |
653 } | 658 } |
654 | 659 |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 | 1248 |
1244 ;; | 1249 ;; |
1245 esac | 1250 esac |
1246 done | 1251 done |
1247 | 1252 |
1248 if [ x"$update" = x"yes" ] ; then | 1253 if [ x"$update" = x"yes" ] ; then |
1249 update_desktop_database | 1254 update_desktop_database |
1250 fi | 1255 fi |
1251 | 1256 |
1252 exit_success | 1257 exit_success |
OLD | NEW |