OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 #--------------------------------------------- | 2 #--------------------------------------------- |
3 # xdg-open | 3 # xdg-open |
4 # | 4 # |
5 # Utility script to open a URL in the registered default application. | 5 # Utility script to open a URL in the registered default application. |
6 # | 6 # |
7 # Refer to the usage() function below for usage. | 7 # Refer to the usage() function below for usage. |
8 # | 8 # |
9 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> | 9 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> |
10 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> | 10 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 #-------------------------------------- | 358 #-------------------------------------- |
359 # Checks for known desktop environments | 359 # Checks for known desktop environments |
360 # set variable DE to the desktop environments name, lowercase | 360 # set variable DE to the desktop environments name, lowercase |
361 | 361 |
362 detectDE() | 362 detectDE() |
363 { | 363 { |
364 # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 | 364 # see https://bugs.freedesktop.org/show_bug.cgi?id=34164 |
365 unset GREP_OPTIONS | 365 unset GREP_OPTIONS |
366 | 366 |
367 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 367 if [ -n "${XDG_CURRENT_DESKTOP}" ]; then |
368 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 368 case "${XDG_CURRENT_DESKTOP}" in |
369 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; | 369 GNOME) |
370 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
l 2>&1; then DE=xfce; | 370 DE=gnome; |
371 elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>
&1; then DE=xfce | 371 ;; |
| 372 KDE) |
| 373 DE=kde; |
| 374 ;; |
| 375 LXDE) |
| 376 DE=lxde; |
| 377 ;; |
| 378 XFCE) |
| 379 DE=xfce |
| 380 esac |
| 381 fi |
| 382 |
| 383 if [ x"$DE" = x"" ]; then |
| 384 # classic fallbacks |
| 385 if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |
| 386 elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; |
| 387 elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop
/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/n
ull 2>&1` ; then DE=gnome; |
| 388 elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/n
ull 2>&1; then DE=xfce; |
| 389 elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null
2>&1; then DE=xfce |
| 390 fi |
372 fi | 391 fi |
373 | 392 |
374 if [ x"$DE" = x"" ]; then | 393 if [ x"$DE" = x"" ]; then |
375 # fallback to checking $DESKTOP_SESSION | 394 # fallback to checking $DESKTOP_SESSION |
376 case "$DESKTOP_SESSION" in | 395 case "$DESKTOP_SESSION" in |
377 gnome) | 396 gnome) |
378 DE=gnome; | 397 DE=gnome; |
379 ;; | 398 ;; |
380 LXDE) | 399 LXDE) |
381 DE=lxde; | 400 DE=lxde; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 ;; | 688 ;; |
670 | 689 |
671 generic) | 690 generic) |
672 open_generic "$url" | 691 open_generic "$url" |
673 ;; | 692 ;; |
674 | 693 |
675 *) | 694 *) |
676 exit_failure_operation_impossible "no method available for opening '$url'" | 695 exit_failure_operation_impossible "no method available for opening '$url'" |
677 ;; | 696 ;; |
678 esac | 697 esac |
OLD | NEW |