Bug 338242 - script-files don't work anymore in autostart-directory
Summary: script-files don't work anymore in autostart-directory
Status: RESOLVED FIXED
Alias: None
Product: ksmserver
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords: regression
: 339928 341374 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-08-13 15:59 UTC by Martin Yrjölä
Modified: 2015-08-17 14:13 UTC (History)
19 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Yrjölä 2014-08-13 15:59:40 UTC
In KDE4 users could symlink or copy their shellscripts to ~/.config/autostart that they wanted to be run when logging in. Now only ".desktop"-files work even though the shellscripts are listen in the Autostart-kcm.

Historically this was done in ksmserver, but the commit https://git.reviewboard.kde.org/r/118977/ removed the functionality because KLauncher also launches files in the autostart-directory leading to duplicate launches and other nasty things.

To reproduce:

1. Verify your Autostart-path from the Paths-KCM (~/.config/autostart)
2. Create a script file test.sh to the autostart-directory with the following content:

#!/bin/sh
konsole

3. chmod +x the script file
4. Verify that the script is listed in the Autostart-KCM below scripts and that it should be run on startup. You can also use the Add program button to add a ".desktop"-file to the autostart-directory to verify that ".desktop"-files work.
5. Log out and log in.

What happens:
konsole doesn't start.

What was expected:
konsole should be started by the script in the autostart directory.

If I revert the commit f913e251fe66e22606c380a8cc0ddc8c69e3c07d in plasma-workspace the scripts will execute, but plasmashell didn't start for me probably because of some blocking.

Build Date & Platform:
2013-08-13 on Arch Linux using kdesrc-build
Comment 1 Martin Yrjölä 2014-08-13 16:06:07 UTC
Also added the bug https://git.reviewboard.kde.org/r/118977/
Comment 2 Martin Yrjölä 2014-08-13 19:51:47 UTC
I propose a fix in https://git.reviewboard.kde.org/r/119773/
Comment 3 Martin Yrjölä 2014-08-19 07:48:56 UTC
I'll moved this bug to plasma because of discussion with David Faure in https://git.reviewboard.kde.org/r/119773/

This problem should be solved in the workspace, not in KF5
Comment 4 Martin Yrjölä 2014-09-02 07:30:52 UTC
plasmashell, not plasma is the right product
Comment 5 Martin Yrjölä 2014-09-02 07:35:36 UTC
As the xdg autostart standard only mentions desktop-files, should we make the "Add script"-button in the  Autostart KCM generate a desktop-file for the given script in the autostart-folder? Then we would only need to make changes to the Autostart KCM. The downside is that then we don't support console users that used to symlink their scripts to the autostart directory. I'm willing to develop a patch if we can settle on a solution.
Comment 6 Martin Yrjölä 2014-09-10 14:39:34 UTC
There was some discussion on #kde-devel about the issue. The autostart-functionality should be moved to ksmserver.

15:41 <mschiff> which component of KDE SC should be doing autostart stuff?
15:43 <rdieter_work> mschiff: kdelibs (at least in v4, not sure where that is included in kf5 yet)
15:43 <mschiff> I am asking for kf5 yes... I want to file a bug (executing a script on startup does not work) but dont know which component to choose...
15:45 <rdieter_work> mschiff: mind sharing the associated .desktop file so I can test/verify?
15:46 <mschiff> rdieter_work: no desktop file, a shell script. You can choose to configure a) desktop files and b) a shell script there....
15:46 <rdieter_work> (and if you haven't tried yet, running desktop-file-validate on it, isn't a bad idea)
15:46 <rdieter_work> ok, I only ever use the .desktop mechanism
15:47 <dfaure> mschiff: I want the autostart stuff to fully move to the workspace (ksmserver)
15:47 <dfaure> there's still some code in kinit, but it makes no sense (IMHO) for it to stay there
15:47 <rdieter_work> mschiff: I think the "script" thing is actually a hook in startkde/start-plasma
15:47 <dfaure> there's a discussion on k-f-d+plasma about all this
15:48 <mschiff> rdieter_work: so a workaround for now would be to create and use a .desktop file
15:48 <rdieter_work> e.g in kde-workspace-4.x, implemented as plopping something into ~/.kde/env/ which is source'd by startkde on login
15:48 <mschiff> dfaure: Thanks. So its worth to wait a bit? I am using master-branch here ...
15:50 <dfaure> mschiff: things don't get fixed magically, better contribute to the discussion :)
15:50 <dfaure> (the discussion is a bit old now)
15:51 <mschiff> dfaure: were you referring to MLs or #channels?
15:51 <dfaure> MLs
15:52 <mschiff> ok, my problem is time right now. I am trying to report bugs as good as I can, but have (currently) not the time to spend reasonable time into contributing :-/
15:53 <dfaure> ok
15:53 <dfaure> well, I pushed the problem away from frameworks, so I don't actually know the current status on the plasma side :-)
15:53 <mschiff> dfaure: if not too time consuming and if it helps I can subscribe and ask for it though if it will help ;)
15:54 <mschiff> I see ok ;)
15:54 <mschiff> thx
16:24 <einar77_work> dfaure: no one is working on that, I actually wanted to, but I wonder where the kinit stuff should end up into
16:24 <einar77_work> (the handling by ksmserver was quite crude)
16:24 <dfaure> I'd put everything into ksmserver, but I might not be uptodate with workspace plans
16:25 <dfaure> to me it makes sense to put everything in the thing that starts the session,
16:25 <dfaure> rather than daemons that get started also by standalone apps on other desktops / OSes
16:25 <einar77_work> would it make sense to move the code from kinit (it's IMO cleaner than what used to be there in ksmserver)?
16:26 <dfaure> yes
16:29 <yrjolam> dfaure, einar77_work: I have made a bug report about the issue https://bugs.kde.org/show_bug.cgi?id=338242
16:29 <bugbot> KDE bug 338242 in plasmashell (general) "script-files don't work anymore in autostart-directory" [Normal,Unconfirmed: ] 
16:31 <yrjolam> There was even a crude patch to bring back scripts-support to kinit. It's mentioned in the comments. Should be a good starting point for bringing the scripts support back.
16:32 <yrjolam> I can volunteer on bringing the support back if someone points me to where we should put the autostart-functionality.
16:33 <einar77_work> yrjolam: ksmserver
16:33 <einar77_work> aka in plasma-workspace/desktop (I don't remember which atm)
Comment 7 Martin Yrjölä 2014-10-26 21:36:28 UTC
Started work on this today. Most of the work involved getting familiar with the code base. I should have the autostart-functionality migrated to ksmserver this week.
Comment 8 Martin Yrjölä 2014-11-07 10:07:26 UTC
I have been busy, so I haven't had the time to come up with a solution :-/

There was another proposed solution on plasma-devel by Jeremy Whiting.

Introduce a ~/.config/ksmserver-autostart directory that is managed by the
autostart kcm and then the scripts are launched at the appropriate
time in plasma-workspace/ksmserver/startup.cpp.
Comment 9 Arjun AK 2014-11-29 07:12:13 UTC
*** Bug 339928 has been marked as a duplicate of this bug. ***
Comment 10 Arjun AK 2014-11-29 07:13:23 UTC
*** Bug 341374 has been marked as a duplicate of this bug. ***
Comment 11 Siddhartha 2015-03-31 04:43:44 UTC
Hi. Has there been further discussion on this?
Spcifically, is there a way to start KSHHASKPASS from a script at startup without creating a desktop file?
Comment 12 Rex Dieter 2015-03-31 11:55:55 UTC
Yes, use /etc/xdg/plasma-workspace/env/
Comment 13 Rex Dieter 2015-03-31 11:57:35 UTC
Oh sorry, that won't work for gui apps, your best bet is to rely on autostart (with .desktop file), either /etc/xdg/autostart or ~/.config/autostart/
Comment 14 Martin Yrjölä 2015-04-10 12:59:28 UTC
I am sadly not using KDE anymore on my work laptop, so I'm removing myself as assignee.
Comment 15 Grief 2015-05-22 18:39:35 UTC
Does anyone currently working on this? The issue is a regression in pretty simple part of code, shouldn't it be easy to fix?
Comment 16 Martin Yrjölä 2015-05-23 08:55:21 UTC
No one is working on this as far as I know.

A naive solution is pretty simple, see https://git.reviewboard.kde.org/r/119773/

But better solutions have been proposed. See comments 6 and 8. Hoewever, they are more involved.
Comment 17 David Faure 2015-07-30 12:49:08 UTC
I just fixed this, including migration from kde4:

https://git.reviewboard.kde.org/r/124534/
Comment 18 David Faure 2015-07-31 13:52:08 UTC
Git commit e33b582fda5588762aa50e3ad619283b97e7d758 by David Faure.
Committed on 31/07/2015 at 13:51.
Pushed by dfaure into branch 'master'.

ksmserver: restore support for autostart scripts; migrate them from the KDE4 dir

Commit f913e251fe6 removed this, due to a porting bug: both klauncher
(XDG autostart using .desktop files) and ksmserver (kde-specific scripts)
were ported to look at the same directory (~/.config/autostart),
leading to double autostart. The right fix, however, is to use
a different directory for scripts, I called it ~/.config/autostart-scripts.
REVIEW: 124534

M  +3    -0    ksmserver/server.h
M  +71   -4    ksmserver/startup.cpp

http://commits.kde.org/plasma-workspace/e33b582fda5588762aa50e3ad619283b97e7d758