summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLuís Pereira <luis.artur.pereira@gmail.com>2021-11-25 15:21:30 +0000
committerSimon Lees <simon@simotek.net>2023-09-21 07:36:32 +0000
commit91c8d8088238369590397523e8a0dec3b27c9af2 (patch)
tree7f39eebd62f06f3d3446ddda03d2b5d7425e81a8 /scripts
parentfa5731c3187f9501f22e0a539b9fc92839a4a34a (diff)
Enhance LXQt Desktop Enviromment support
The LXQt project has developed a CLI mime apps toolset (qtxdg-mat). LXQt uses the '$desktop-mimeapps.list' file to store the associations and defaults. In xdg-settings we use the already existent set_browser_mime() function so that the fix_local_desktop_file() can be run. set_browser_mime calls uses xdg-mime to set the protocols, so LXQt desktop aware mimeapps.list is properly taken care.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/xdg-email.in31
-rw-r--r--scripts/xdg-mime.in74
-rwxr-xr-xscripts/xdg-open.in12
-rwxr-xr-xscripts/xdg-settings.in91
4 files changed, 202 insertions, 6 deletions
diff --git a/scripts/xdg-email.in b/scripts/xdg-email.in
index 6135b24..b302dc4 100644
--- a/scripts/xdg-email.in
+++ b/scripts/xdg-email.in
@@ -191,6 +191,31 @@ open_gnome()
}
+open_lxqt()
+{
+ local client
+ local desktop
+ desktop=`qtxdg-mat def-email-client 2>/dev/null`
+ client=`desktop_file_to_binary "$desktop"`
+ echo $client | grep -E 'thunderbird|icedove' > /dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ run_thunderbird "$client" "$1"
+ fi
+
+ if qtxdg-mat open --help 2>/dev/null 1>&2; then
+ qtxdg-mat open "$1"
+ else
+ exit_failure_operation_impossible "no method available for opening '$1'"
+ fi
+
+ if [ $? -eq 0 ]; then
+ exit_success
+ else
+ exit_failure_operation_failed
+ fi
+}
+
+
open_xfce()
{
DEBUG 1 "Running exo-open \"$1\""
@@ -452,6 +477,10 @@ case "$DE" in
open_gnome3 "${mailto}"
;;
+ lxqt)
+ open_lxqt "${mailto}"
+ ;;
+
xfce)
open_xfce "${mailto}"
;;
@@ -460,7 +489,7 @@ case "$DE" in
open_flatpak "${mailto}"
;;
- generic|lxqt|enlightenment)
+ generic|enlightenment)
open_generic "${mailto}"
;;
diff --git a/scripts/xdg-mime.in b/scripts/xdg-mime.in
index 97e7368..1f7c5e3 100644
--- a/scripts/xdg-mime.in
+++ b/scripts/xdg-mime.in
@@ -99,6 +99,21 @@ info_gnome()
fi
}
+info_lxqt()
+{
+ if qtxdg-mat mimetype --help 2>/dev/null 1>&2; then
+ qtxdg-mat mimetype "$1" 2>/dev/null
+ else
+ exit_failure_operation_impossible "no method available for querying MIME type of '$filename'"
+ fi
+
+ if [ $? -eq 0 ]; then
+ exit_success
+ else
+ exit_failure_operation_failed
+ fi
+}
+
info_generic()
{
if mimetype --version >/dev/null 2>&1; then
@@ -243,6 +258,23 @@ make_default_kde()
fi
}
+make_default_lxqt()
+{
+ # $1 is vendor-name.desktop
+ # $2 is mime/type
+ if qtxdg-mat defapp --help 2>/dev/null 1>&2; then
+ qtxdg-mat defapp --set "$1" "$2" 1>/dev/null
+ else
+ exit_failure_operation_impossible "no method available for setting the default application for MIME type(s) of '$mimetype'"
+ fi
+
+ if [ $? -eq 0 ]; then
+ exit_success
+ else
+ exit_failure_operation_failed
+ fi
+}
+
make_default_generic()
{
# $1 is vendor-name.desktop
@@ -474,6 +506,21 @@ defapp_kde()
fi
}
+defapp_lxqt()
+{
+ if qtxdg-mat defapp --help 2>/dev/null 1>&2; then
+ qtxdg-mat defapp "$1"
+ else
+ exit_failure_operation_impossible "no method available for querying the default application for MIME type of '$mimetype'"
+ fi
+
+ if [ $? -eq 0 ]; then
+ exit_success
+ else
+ exit_failure_operation_failed
+ fi
+}
+
[ x"$1" != x"" ] || exit_failure_syntax
mode=
@@ -576,6 +623,8 @@ if [ "$action" = "makedefault" ]; then
exit_failure_syntax "mimetype argument missing"
fi
+ detectDE
+
while [ $# -gt 0 ] ; do
case $1 in
-*)
@@ -585,8 +634,16 @@ if [ "$action" = "makedefault" ]; then
mimetype="$1"
shift
- make_default_kde "$filename" "$mimetype"
- make_default_generic "$filename" "$mimetype"
+ case "$DE" in
+ lxqt)
+ make_default_lxqt "$filename" "$mimetype"
+ ;;
+
+ *)
+ make_default_kde "$filename" "$mimetype"
+ make_default_generic "$filename" "$mimetype"
+ ;;
+ esac
done
exit_success
fi
@@ -609,6 +666,10 @@ if [ "$action" = "info" ]; then
info_gnome "$filename"
;;
+ lxqt)
+ info_lxqt "$filename"
+ ;;
+
*)
info_generic "$filename"
;;
@@ -623,8 +684,15 @@ if [ "$action" = "defapp" ]; then
defapp_kde "$mimetype"
fi
- defapp_generic "$mimetype"
+ case "$DE" in
+ lxqt)
+ defapp_lxqt "$mimetype"
+ ;;
+ *)
+ defapp_generic "$mimetype"
+ ;;
+ esac
exit_failure_operation_impossible "no method available for querying default application for '$mimetype'"
fi
diff --git a/scripts/xdg-open.in b/scripts/xdg-open.in
index c1bf58e..5b59263 100755
--- a/scripts/xdg-open.in
+++ b/scripts/xdg-open.in
@@ -520,7 +520,17 @@ open_lxde()
open_lxqt()
{
- open_generic "$1"
+ if qtxdg-mat open --help 2>/dev/null 1>&2; then
+ qtxdg-mat open "$1"
+ else
+ exit_failure_operation_impossible "no method available for opening '$1'"
+ fi
+
+ if [ $? -eq 0 ]; then
+ exit_success
+ else
+ exit_failure_operation_failed
+ fi
}
[ x"$1" != x"" ] || exit_failure_syntax
diff --git a/scripts/xdg-settings.in b/scripts/xdg-settings.in
index 40f739e..ed3554c 100755
--- a/scripts/xdg-settings.in
+++ b/scripts/xdg-settings.in
@@ -386,6 +386,49 @@ set_browser_gnome3()
done
}
# }}} GNOME 3.x
+# {{{ LXQt
+
+get_browser_lxqt()
+{
+ if qtxdg-mat def-web-browser --help 2> /dev/null 1>&2; then
+ qtxdg-mat def-web-browser 2>/dev/null
+ else
+ exit_failure_operation_impossible "no method for getting the default browser"
+ fi
+}
+
+check_browser_lxqt()
+{
+ desktop="$1"
+ check="`desktop_file_to_binary "$1"`"
+ if [ -z "$check" ]; then
+ echo no
+ exit_success
+ fi
+
+ if qtxdg-mat def-web-browser --help 2>/dev/null 1>&2; then
+ browser="`qtxdg-mat def-web-browser`" 2>/dev/null
+ if [ x"$browser" != x"$desktop" ]; then
+ echo no
+ exit_success
+ fi
+ else
+ exit_failure_operation_impossible "no method for checking the default browser"
+ fi
+}
+
+set_browser_lxqt()
+{
+ binary="`desktop_file_to_binary "$1"`"
+ [ "$binary" ] || exit_failure_file_missing
+ set_browser_mime "$1" || return
+
+ # Set the default browser.
+ for protocol in http https about unknown; do
+ set_browser_mime "$1" "x-scheme-handler/$protocol" || return
+ done
+}
+# }}} LXQt
# {{{ xfce
get_browser_xfce()
@@ -678,6 +721,48 @@ set_url_scheme_handler_gnome()
}
# }}} GNOME
+# {{{ LXQt
+
+get_url_scheme_handler_lxqt()
+{
+ if qtxdg-mat defapp --help 2> /dev/null 1>&2; then
+ qtxdg-mat defapp "x-scheme-handler/$1" 2> /dev/null
+ else
+ exit_failure_operation_impossible "no method for getting the url_scheme_handler"
+ fi
+}
+
+check_url_scheme_handler_lxqt()
+{
+ desktop="$2"
+ check="`desktop_file_to_binary "$2"`"
+ if [ -z "$check" ]; then
+ echo no
+ exit_success
+ fi
+
+ if qtxdg-mat defapp --help 2> /dev/null 1>&2; then
+ handler="`qtxdg-mat defapp "x-scheme-handler/$1"`" 2> /dev/null
+ if [ x"$handler" != x"$desktop" ]; then
+ echo no
+ exit_success
+ fi
+ else
+ exit_failure_operation_impossible "no method for checking the url_scheme_handler for desktop $DE"
+ fi
+}
+
+set_url_scheme_handler_lxqt()
+{
+ binary="`desktop_file_to_binary "$2"`"
+ [ "$binary" ] || exit_failure_file_missing
+ set_browser_mime "$2" || return
+
+ # Set the default browser.
+ set_browser_mime "$2" "x-scheme-handler/$1" || return
+}
+
+# }}} LXQt
# {{{ GNOME 3.x
get_url_scheme_handler_gnome3()
@@ -880,11 +965,15 @@ case "$DE" in
dispatch_specific gnome3 "$@"
;;
+ lxqt)
+ dispatch_specific lxqt "$@"
+ ;;
+
xfce)
dispatch_specific xfce "$@"
;;
- generic|lxqt|enlightenment)
+ generic|enlightenment)
dispatch_specific generic "$@"
;;