! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Exec in ~/.config/autostart/*.desktop doesn't support commands with arguments
Status:
RESOLVED: DUPLICATE
Product:
Xfce4-session
Component:
General

Comments

Description Albert 2018-01-22 15:10:19 CET
The content of `keyboard.desktop` is shown below:

```
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=colemak keyboard
Comment=
Exec=bash /home/albert/bin/colemak.sh
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=true
Hidden=false

```

Extract the core logic from https://git.xfce.org/xfce/xfce4-session/tree/scripts/xinitrc.in.in#n162, and run it in a shell:

```shell
$ cmd=`grep -E "^Exec=" keyboard.desktop | cut -d'=' -f2`; test "$cmd" && which "$cmd" ; echo $?
1
```

I suppose the spec is https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html, and it states that passing arguments are supported.

(Surely, I can work around this problem by dropping the preceding `bash`.)
Comment 1 Kyler Laird 2018-08-05 19:43:52 CEST
This does not just affect ~/.config/autostart/*.desktop files; my /usr/local/share/applications/*.desktop files are also not working (unless they happen to not use command line arguments).
Comment 2 Theo Linkspfeifer editbugs 2019-04-19 22:06:01 CEST
I created a new launcher (Exec=mousepad /home/user/Notes.txt) and moved it to the autostart directory. On the next login I had a open Mousepad window showing the Notes.txt.
Comment 3 Theo Linkspfeifer editbugs 2019-05-05 13:44:44 CEST
After reading the bug description again I understand now that the issue is in the fallback code. Proposed fix:

cmd=`grep -E "^Exec=" "$i" | cut -d'=' -f2`
cmd_noargs=`echo "$cmd" | cut -d' ' -f1`
if test "$cmd_noargs" && which "$cmd_noargs" >/dev/null 2>&1; then
  $cmd &
fi
Comment 4 Albert 2019-05-05 14:16:39 CEST
> On the next login I had a open Mousepad window showing the Notes.txt.

I am curious how that happened.

Thanks fort the proposed fix.
Comment 5 Skunnyk editbugs 2019-05-05 23:33:52 CEST
This part of scripts/xinitrc.in.in is only executed when running xfce without xfce4-session (corner case I guess), and need to be fixed. It parses manually the .desktop entries :(

It should work when using xfce4-session (normal start), but I can't test right now…

exec = xfce_rc_read_entry (rc, "Exec", NULL);
[...]          
if (!xfce_spawn_command_line_on_screen (gdk_screen_get_default (),
          exec,
          terminal,
          startup_notify,
          &error))
{
Comment 6 Skunnyk editbugs 2019-05-06 00:13:30 CEST
I confirm that "Exec=bash /home/skunnyk/testme.sh" in autostart works when I use xfce4-session
Comment 7 Skunnyk editbugs 2019-05-06 14:20:57 CEST
I try to understand in which case this part on xinitrc code is used (i.e: run xfce4-session xinitrc without… xfce4-session ?!)
See my comment in https://bugzilla.xfce.org/show_bug.cgi?id=14681#c2
Comment 8 Marcos Mello 2019-05-12 21:26:05 CEST
xfce4-session is required now (bug 14681). This bug can be closed.
Comment 9 Skunnyk editbugs 2019-05-13 13:39:09 CEST

*** This bug has been marked as a duplicate of bug 14681 ***

Bug #14187

Reported by:
Albert
Reported on: 2018-01-22
Last modified on: 2019-05-13

People

Assignee:
Skunnyk
CC List:
6 users

Version

Version:
4.12.0

Attachments

Additional information