| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 exit_failure_file_permission_read() | 85 exit_failure_file_permission_read() |
| 86 { | 86 { |
| 87 if [ $# -gt 0 ]; then | 87 if [ $# -gt 0 ]; then |
| 88 echo "@NAME@: $@" >&2 | 88 echo "@NAME@: $@" >&2 |
| 89 fi | 89 fi |
| 90 | 90 |
| 91 exit 5 | 91 exit 5 |
| 92 } | 92 } |
| 93 | 93 |
| 94 #------------------------------------------------------------ | 94 #------------------------------------------------------------ |
| 95 # Exit script on insufficient permission to read a specified file | 95 # Exit script on insufficient permission to write a specified file |
| 96 | 96 |
| 97 exit_failure_file_permission_write() | 97 exit_failure_file_permission_write() |
| 98 { | 98 { |
| 99 if [ $# -gt 0 ]; then | 99 if [ $# -gt 0 ]; then |
| 100 echo "@NAME@: $@" >&2 | 100 echo "@NAME@: $@" >&2 |
| 101 fi | 101 fi |
| 102 | 102 |
| 103 exit 6 | 103 exit 6 |
| 104 } | 104 } |
| 105 | 105 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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 xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then
DE=xfce; | 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 fi | 200 fi |
| 200 } | 201 } |
| 201 | 202 |
| 202 #---------------------------------------------------------------------------- | 203 #---------------------------------------------------------------------------- |
| 203 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 204 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |
| 204 # It also always returns 1 in KDE 3.4 and earlier | 205 # It also always returns 1 in KDE 3.4 and earlier |
| 205 # Simply return 0 in such case | 206 # Simply return 0 in such case |
| 206 | 207 |
| 207 kfmclient_fix_exit_code() | 208 kfmclient_fix_exit_code() |
| 208 { | 209 { |
| 209 version=`kde${KDE_SESSION_VERSION}-config --version 2>/dev/null | grep KDE` | 210 version=`kde${KDE_SESSION_VERSION}-config --version 2>/dev/null | grep KDE` |
| 210 major=`echo $version | sed 's/KDE: \([0-9]\).*/\1/'` | 211 major=`echo $version | sed 's/KDE: \([0-9]\).*/\1/'` |
| 211 minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'` | 212 minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'` |
| 212 release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 213 release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |
| 213 test "$major" -gt 3 && return $1 | 214 test "$major" -gt 3 && return $1 |
| 214 test "$minor" -gt 5 && return $1 | 215 test "$minor" -gt 5 && return $1 |
| 215 test "$release" -gt 4 && return $1 | 216 test "$release" -gt 4 && return $1 |
| 216 return 0 | 217 return 0 |
| 217 } | 218 } |
| OLD | NEW |