From 0f49cf5d7956076fccd599d82b85946e5e49d473 Mon Sep 17 00:00:00 2001 From: Slatian Date: Mon, 4 Dec 2023 00:12:59 +0000 Subject: Add support for deeping-desktop browser setting in xdg-settings. Original patch by ssk-wh Rebased and shellchecked (quoting) --- scripts/xdg-settings.in | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/scripts/xdg-settings.in b/scripts/xdg-settings.in index 59e97cb..a62eedd 100755 --- a/scripts/xdg-settings.in +++ b/scripts/xdg-settings.in @@ -278,6 +278,44 @@ set_browser_kde() } # }}} KDE +# {{{ Deepin + +read_deepin_browser() +{ + dbus-send --print-reply=literal --dest=com.deepin.daemon.Mime /com/deepin/daemon/Mime com.deepin.daemon.Mime.GetDefaultApp string:"x-scheme-handler/http" | jq -r '.Id' +} + +get_browser_deepin() +{ + browser="$(read_deepin_browser)" + if [ -n "$browser" ]; then + echo "$browser" + exit_success + else + exit_failure_operation_failed + fi +} + +check_browser_deepin() +{ + if [ "$(read_deepin_browser)" = "$1" ]; then + exit_success + else + exit_failure_operation_failed + fi +} + +set_browser_deepin() +{ + xdg-mime default "$1" x-scheme-handler/http x-scheme-handler/ftp x-scheme-handler/https text/html text/xml text/xhtml_xml text/xhtml+xml + if [ $? -ne 0 ]; then + exit_failure_operation_failed + else + exit_success + fi +} + +# }}} Deepin # {{{ GNOME get_browser_gnome() @@ -958,6 +996,10 @@ case "$DE" in dispatch_specific kde "$@" ;; + deepin) + dispatch_specific deepin "$@" + ;; + gnome) dispatch_specific gnome "$@" ;; -- cgit v1.2.3