Custom URL Schemata?

Achim Bohnet abohnet at gwdg.de
Tue Nov 1 08:29:25 UTC 2016


> On 29 Oct 2016, at 21:40, David Faure <faure at kde.org> wrote:
> 
> On samedi 29 octobre 2016 09:30:58 CEST fREW Schmidt wrote:
>> I don't really use a DE.  I figured out a solution myself if
>> interested:
>> https://blog.afoolishmanifesto.com/posts/custom-uri-schemata-on-linux/
> 
> Interesting patch for xdg-open in there (to support Terminal=true).
> 
> My own testing (after forcing xdg-open to call the open_generic function)
> indicates that xdg-terminal fails when called with multiple arguments
> so I had to modify your patch slightly, to say
>   xdg-terminal "$command_exec $@"
> instead of
>   xdg-terminal "$command_exec" "$@“

with more than one argument xdg-termial is again called with several arguments.
Further one would never know if the program name or the first arg contained the space.

(0)allee at ex-lm50:~$ cat xx
#!/bin/bash

echoargs () {
	for x; do 
		echo -n "<<$x>>"
	done
	echo
}

echoargs ONE: "program $@"

echoargs TWO: "progam" "$@"
(0)allee at ex-lm50:~$ bash xx  "1 2 3" 4 5 "  6"
<<ONE:>><<program 1 2 3>><<4>><<5>><<  6>>
<<TWO:>><<progam>><<1 2 3>><<4>><<5>><<  6>>


IMHO xdc-terminal need to be fixed.

Achim

> 
> Here's the patch, any objections against me committing it?
> 
> diff --git i/scripts/xdg-open.in w/scripts/xdg-open.in
> index cb41ac6..62ef54b 100644
> --- i/scripts/xdg-open.in
> +++ w/scripts/xdg-open.in
> @@ -282,7 +282,11 @@ search_desktop_file()
>             args=$(( $args - 1 ))
>         done
>         [ $replaced -eq 1 ] || set -- "$@" "$target"
> -        "$command_exec" "$@"
> +        if [ "$(get_key "${file}" "Terminal")" = true ]; then
> +           xdg-terminal "$command_exec $@"
> +        else
> +           "$command_exec" "$@"
> +        fi
> 
>         if [ $? -eq 0 ]; then
>             exit_success
> 
> -- 
> David Faure, faure at kde.org, http://www.davidfaure.fr
> Working on KDE Frameworks 5
> 
> _______________________________________________
> xdg mailing list
> xdg at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/xdg

-- 
 To me vi is Zen.  To use vi is to practice zen. Every command is
 a koan. Profound to the user, unintelligible to the uninitiated.
 You discover truth everytime you use it.
                                     -- reddy at lion.austin.ibm.com



More information about the xdg mailing list