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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 detectDE() | 194 detectDE() |
195 { | 195 { |
196 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 196 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
197 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 197 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; | 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; |
199 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 199 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; |
200 fi | 200 fi |
201 | 201 |
202 if [ x"$DE" = x"" ]; then | 202 if [ x"$DE" = x"" ]; then |
203 # if all else fails, fallback to checking $DESKTOP_SESSION | 203 # fallback to checking $DESKTOP_SESSION |
204 case "$DESKTOP_SESSION" in | 204 case "$DESKTOP_SESSION" in |
205 LXDE) | 205 LXDE) |
206 DE=lxde; | 206 DE=lxde; |
207 ;; | 207 ;; |
208 xfce|xfce4) | 208 xfce|xfce4) |
209 DE=xfce; | 209 DE=xfce; |
210 ;; | 210 ;; |
211 esac | 211 esac |
212 fi | 212 fi |
213 | 213 |
| 214 if [ x"$DE" = x"" ]; then |
| 215 # fallback to uname output for other platforms |
| 216 case "$(uname 2>/dev/null)" in |
| 217 Darwin) |
| 218 DE=darwin; |
| 219 ;; |
| 220 esac |
| 221 fi |
| 222 |
214 if [ x"$DE" = x"gnome" ]; then | 223 if [ x"$DE" = x"gnome" ]; then |
215 # gnome-default-applications-properties is only available in GNOME 2.x | 224 # gnome-default-applications-properties is only available in GNOME 2.x |
216 # but not in GNOME 3.x | 225 # but not in GNOME 3.x |
217 which gnome-default-applications-properties 2> /dev/null || DE="gnome3" | 226 which gnome-default-applications-properties 2> /dev/null || DE="gnome3" |
218 fi | 227 fi |
219 } | 228 } |
220 | 229 |
221 #---------------------------------------------------------------------------- | 230 #---------------------------------------------------------------------------- |
222 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 231 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
223 # It also always returns 1 in KDE 3.4 and earlier | 232 # It also always returns 1 in KDE 3.4 and earlier |
224 # Simply return 0 in such case | 233 # Simply return 0 in such case |
225 | 234 |
226 kfmclient_fix_exit_code() | 235 kfmclient_fix_exit_code() |
227 { | 236 { |
228 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; | 237 [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; |
229 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` | 238 version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` |
230 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` | 239 major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` |
231 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` | 240 minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` |
232 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 241 release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
233 test "$major" -gt 3 && return $1 | 242 test "$major" -gt 3 && return $1 |
234 test "$minor" -gt 5 && return $1 | 243 test "$minor" -gt 5 && return $1 |
235 test "$release" -gt 4 && return $1 | 244 test "$release" -gt 4 && return $1 |
236 return 0 | 245 return 0 |
237 } | 246 } |
OLD | NEW |