Bug 93231 - xdg-terminal does not work when gsettings is used to get the default terminal
Summary: xdg-terminal does not work when gsettings is used to get the default terminal
Status: RESOLVED MOVED
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Per Olofsson
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-03 16:35 UTC by Ronan Arraes Jardim Chagas
Modified: 2019-02-16 13:37 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Fixes -x argument, which is the default for {gnome,mate}-terminal (1.42 KB, patch)
2016-01-22 15:02 UTC, Sorokin Alexei
Details | Splinter Review

Description Ronan Arraes Jardim Chagas 2015-12-03 16:35:29 UTC
Hi!

I'm trying to open the default terminal using xdg-terminal in MATE. However, when I execute `xdg-terminal` I get the following output:

xdg-terminal: configured terminal program ''mate-terminal'' not found or not executable

It turns out that, in MATE, `xdg-terminal` uses the following code to get the default terminal:

gsettings get org.mate.applications-terminal exec

(see http://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-terminal.in#n85)

However, this command in MATE returns:

gsettings get org.mate.applications-terminal exec              
'mate-terminal'

Thus, xdg-terminal tries to execute `'mate-terminal'` instead of `mate-terminal`, which is the cause of the bug.

This happens regardless the terminal that I choose to be the default:

xterm:
$ gsettings get org.mate.applications-terminal exec
'xterm'

konsole:
gsettings get org.mate.applications-terminal exec
'konsole'

Hence, I think that xdg-terminal just need to remove '' from the returned string and execute it.

Additional information about my system:

$ cat /etc/os-release
NAME=openSUSE
VERSION="Tumbleweed"
VERSION_ID="20151128"
PRETTY_NAME="openSUSE Tumbleweed (20151128) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:20151128"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.org/"
ID_LIKE="suse"

$ xdg-terminal --version
xdg-terminal 1.1.0 rc3
Comment 1 Ronan Arraes Jardim Chagas 2015-12-03 16:40:00 UTC
Notice that I tested under MATE, but this bug should affect all DE in which xdg-terminal uses gsettings to get the default terminal, like GNOME and Cinnamon.
Comment 2 Ronan Arraes Jardim Chagas 2015-12-03 16:51:26 UTC
The following patch completely fixes the issue:

$cat xdg-terminal-fix-gsettings.patch 
--- a	2015-12-03 14:46:29.679354374 -0200
+++ b	2015-12-03 14:49:08.144583541 -0200
@@ -514,8 +514,8 @@
 {
     term_schema="$1"; shift
 
-    term_exec=`gsettings get ${term_schema} exec`
-    term_exec_arg=`gsettings get ${term_schema} exec-arg`
+    term_exec=`gsettings get ${term_schema} exec | sed -r "s/^'(.*)'$/\1/"`
+    term_exec_arg=`gsettings get ${term_schema} exec-arg | sed -r "s/^'(.*)'$/\1/"`
 
     terminal_exec=`which $term_exec 2>/dev/null`
Comment 3 Jiri Slaby 2015-12-06 10:37:25 UTC
A wrong one.
Comment 4 Ronan Arraes Jardim Chagas 2015-12-28 20:11:21 UTC
@Jiri Slaby

Sorry? I did not understand.
Comment 5 Sorokin Alexei 2016-01-22 15:02:17 UTC
Created attachment 121208 [details] [review]
Fixes -x argument, which is the default for {gnome,mate}-terminal

Also related to brokenness of xdg-terminal on GSettings-based desktop environments.
Comment 6 Joshua Krämer 2019-01-02 12:31:35 UTC
Please merge the two proposed patches (comments 2 and 5).

The patches are already used by openSUSE, see: https://build.opensuse.org/package/show/openSUSE:Factory/xdg-utils
Comment 7 GitLab Migration User 2019-02-16 13:37:07 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/85.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.