The percentage character ("%") is not treated the same way when appearing in a desktop file put in ~/.config/autostart or ~/.local/share/applications. With this simple example : [Desktop Entry] Encoding=UTF-8 Version=0.9.4 Type=Application Name=testcmd Comment= Exec=xfce4-terminal -H -x echo %% OnlyShowIn=XFCE; RunHook=0 StartupNotify=false Terminal=false Hidden=false When this desktop file is put in ~/.local/share/applications, and "executed" by "gtk-launch testcmd", a terminal appears with "%" as content (expected behavior). When this desktop file is put in ~/.config/autostart, and the desktop session restarted, a terminal appears with "%%" as content (unexpected behavior). I think the good behavior is the first one, but at least, it should be the same in both cases.
This is called field code expansion. See: https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html I assume that xfce4-session does not do this type of evaluation because it seems unnecessary for autostart launchers.
Yes, I know this is called "field code expansion": I read the specification. :) That's why I said "expected behavior" in the first case ("%%" gives "%" on display), but not in the second one. However, I'm not agree with you when you say that "this type of evaluation […] seems unnecessary for autostart launchers". The percentage character can appear in option fields of many commands, like "top -o%MEM". So if you have in your desktop file Exec=xfce4-terminal -H -x top -o%MEM or a more complex command, like Exec=sh -c '… if [ … ]; then xfce4-terminal -H -x top -o%MEM; fi …' the launcher will work as autostart application (when put in ~/.config/autostart), but not in an active session (when put in ~/.local/share/applications). Furthermore, if you remove the line OnlyShowIn=XFCE; to use the launcher as autostart application with an other desktop environment, like gnome, it will not work, because gnome has consistent behavior between autostart and applications menu: I tested this.
Would you be able to provide a patch?
Well, I haven't thought about it. I would have to clone the repository, dive into the code, and see what I can do. It is not impossible that I could provide something in the end, but I have no idea when! :D But hey, why not: if it's not a priority, and nobody has the time to take care of it, I can try to have a look. :) (concerning the result,I don't promise anything though)
Created attachment 9691 patch for autostart applications
Created attachment 9692 test file
Well, I think I have a patch, but with minimum work: this is essentially an adapted copy of the part called "/* expand the field codes */" in garcon/garcon-gtk/garcon-gtk-menu.c (line 383), to the function xfsm_launch_desktop_files_on_run_hook in xfce4-session/xfce4-session/xfsm-global.c I think (not sure) that a better way to do it would be to directly use garcon, as it is done in xfce4-panel, but I feel like it's significantly more work. I have attached the patch and a test file.
Thanks for the patch. I will give it a try soon. Maybe the code could be moved to libxfce4util/xfce-miscutils.c which contains a similar function xfce_expand_variables().
Created attachment 9851 0001-Patch-for-autostart-applications.patch Change author in case of commit.
-- GitLab Migration Automatic Message -- This bug has been migrated to xfce.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.xfce.org/xfce/xfce4-session/-/issues/64. Please create an account or use an existing account on one of our supported OAuth providers. If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev