| OLD | NEW |
| 1 | 1 |
| 2 #---------------------------------------------------------------------------- | 2 #---------------------------------------------------------------------------- |
| 3 # Common utility functions included in all XDG wrapper scripts | 3 # Common utility functions included in all XDG wrapper scripts |
| 4 #---------------------------------------------------------------------------- | 4 #---------------------------------------------------------------------------- |
| 5 | 5 |
| 6 DEBUG() | 6 DEBUG() |
| 7 { | 7 { |
| 8 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0; | 8 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && return 0; |
| 9 [ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0; | 9 [ ${XDG_UTILS_DEBUG_LEVEL} -lt $1 ] && return 0; |
| 10 shift | 10 shift |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 # All output to stderr | 186 # All output to stderr |
| 187 xdg_redirect_output=" >&2" | 187 xdg_redirect_output=" >&2" |
| 188 fi | 188 fi |
| 189 | 189 |
| 190 #-------------------------------------- | 190 #-------------------------------------- |
| 191 # Checks for known desktop environments | 191 # Checks for known desktop environments |
| 192 # set variable DE to the desktop environments name, lowercase | 192 # set variable DE to the desktop environments name, lowercase |
| 193 | 193 |
| 194 detectDE() | 194 detectDE() |
| 195 { | 195 { |
| 196 # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 |
| 197 unset GREP_OPTIONS |
| 198 |
| 196 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 199 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
| 197 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 200 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; |
| 198 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; | 201 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; |
| 199 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 202 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
| 203 elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>
&1; then DE=xfce |
| 200 fi | 204 fi |
| 201 | 205 |
| 202 if [ x"$DE" = x"" ]; then | 206 if [ x"$DE" = x"" ]; then |
| 203 # fallback to checking $DESKTOP_SESSION | 207 # fallback to checking $DESKTOP_SESSION |
| 204 case "$DESKTOP_SESSION" in | 208 case "$DESKTOP_SESSION" in |
| 209 gnome) |
| 210 DE=gnome; |
| 205 LXDE) | 211 LXDE) |
| 206 DE=lxde; | 212 DE=lxde; |
| 207 ;; | 213 ;; |
| 208 xfce|xfce4) | 214 xfce|xfce4) |
| 209 DE=xfce; | 215 DE=xfce; |
| 210 ;; | 216 ;; |
| 211 esac | 217 esac |
| 212 fi | 218 fi |
| 213 | 219 |
| 214 if [ x"$DE" = x"" ]; then | 220 if [ x"$DE" = x"" ]; then |
| (...skipping 12 matching lines...) Expand all Loading... |
| 227 fi | 233 fi |
| 228 } | 234 } |
| 229 | 235 |
| 230 #---------------------------------------------------------------------------- | 236 #---------------------------------------------------------------------------- |
| 231 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 237 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
| 232 # It also always returns 1 in KDE 3.4 and earlier | 238 # It also always returns 1 in KDE 3.4 and earlier |
| 233 # Simply return 0 in such case | 239 # Simply return 0 in such case |
| 234 | 240 |
| 235 kfmclient_fix_exit_code() | 241 kfmclient_fix_exit_code() |
| 236 { | 242 { |
| 237 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; | |
| 238 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` | 243 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
| 239 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` | 244 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
| 240 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` | 245 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
| 241 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 246 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
| 242 test "$major" -gt 3 && return $1 | 247 test "$major" -gt 3 && return $1 |
| 243 test "$minor" -gt 5 && return $1 | 248 test "$minor" -gt 5 && return $1 |
| 244 test "$release" -gt 4 && return $1 | 249 test "$release" -gt 4 && return $1 |
| 245 return 0 | 250 return 0 |
| 246 } | 251 } |
| OLD | NEW |