Bug 437883 - the Terminal options for adding a startup application have no effect
Summary: the Terminal options for adding a startup application have no effect
Status: CONFIRMED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_autostart (show other bugs)
Version: 5.21.5
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: thenujan
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2021-05-31 00:50 UTC by skierpage
Modified: 2024-09-16 10:42 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description skierpage 2021-05-31 00:50:43 UTC
SUMMARY
I created a script to run some programs at startup. When I used kcm_autostart's + Add Application... dialog I checked the Terminal options "Run in terminal" and "Do not close when command exits" to help me debug it. But these have no effect in Fedora 34.

STEPS TO REPRODUCE
1. Run System Settings > Startup and Shutdown > Autostart
2. Choose + Add... > + Add Application and select the program Utilities > KWrite
3. Expand Terminal options and check  "Run in terminal" and "Do not close when command exits"
4. Click [OK]
5. Restart KDE
6. Look in journalctl output

OBSERVED RESULT
KWrite will start up. But it doesn't seem to start from a terminal, and the terminal doesn't remain around.
If you run `journalctl -r` you'll see something like
   ... systemd-xdg-autostart-generator[4999]: /home/USER/.config/autostart/KWrite.desktop:
14: Unknown key name 'TerminalOptions' in section 'Desktop Entry', ignoring.

EXPECTED RESULT
The Terminal options should have some effect, or they should be removed from the Choose Application dialog in Autostart.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2 64-bit, Wayland

ADDITIONAL INFORMATION

Adding a startup application creates a .desktop file in $HOME/.config/autostart e.g. KWrite.desktop, and these two options add the following lines to it:
    Terminal=true
    TerminalOptions=\s--noclose
Bug 433304 reports that TerminalOptions is deprecated. But Terminal=true doesn't generate warnings yet doesn't seem to have an effect.

The actual startup of the application on Fedora 34 seems driven by systemd, which at startup runs /usr/lib/systemd/user-generators/systemd-xdg-autostart-generator to create service files in /run/user/1000/systemd/generator.late/ . So maybe systemd doesn't recognize these terminal options in a desktop file. Whereas user-facing launchers like the `gtk-launch` command-line program and the KDE "Start menu" Application Launcher do pay attention to these terminal options

The component that displays the Choose Application dialog and its "Terminal options" is https://invent.kde.org/frameworks/kio/-/blob/master/src/widgets/kopenwithdialog.cpp#L750
Comment 1 Nicolas Fella 2021-05-31 10:56:51 UTC
I would not be surprised if systemd ignores deprecated entries and I would assume any attempt to add support will be WONTFIX

However Terminal is not marked as deprecated, so I'd say upstream issue?
https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html

For TerminalOptions we probably have no other option than to remove it from the UI
Comment 2 David Edmundson 2021-06-01 23:24:14 UTC
I can confirm that xdg-autostart-generator currently deliberately ignores Terminal.

We can try and add it if it's really part of the spec and if there's a real-world use-case.

What are you using it for? Presumably kwrite was used just as an example?
Comment 3 David Edmundson 2021-06-01 23:28:54 UTC
It's going to be a very difficult thing to do upstream as there isn't a standard for finding the correct terminal.

We currently parse kdeglobals, with a hardcoded fallback (KIO::DesktopExecParser::resultingArguments) , but that obviously won't work upstream.
Comment 4 skierpage 2021-06-04 23:19:35 UTC
(In reply to David Edmundson from comment #2)
> What are you using it for? Presumably kwrite was used just as an example?
As I remarked in bug 437880#c6 , for years I had a login script to launch Konsole that simply ran `konsole --tabs-from-file ~/dotfiles/session.konsole`. It stopped working around the upgrade to Fedora 34 on Wayland and I couldn't figure out why, so I moved it to Autostart > Add Application and set the terminal options to see what was going on. I wound up using `konsole --hold` instead and fixed my problem; however imagine the general case of someone trying to debug an Autostart application who wants to see stdout and stderr.

If nothing else uses KOpenWithDialog then it seems fine to remove the Terminal options; there are other ways to debug application startup.

Thanks for working on this! 👍
Comment 5 Claudius 2022-06-27 12:41:36 UTC
I had the same issues.

I disabled systemd-autostart using 
> kwriteconfig5 --file startkderc --group General --key systemdBoot false
and everything went back to normal. KeePass now also always starts properly instead of only sometimes.
Comment 6 thenujan 2023-07-25 07:28:12 UTC
Merge request https://invent.kde.org/frameworks/kio/-/merge_requests/1353