Bug 454858 - Autostart > Pre-startup Scripts" shows scripts that startplasma ignores
Summary: Autostart > Pre-startup Scripts" shows scripts that startplasma ignores
Status: CONFIRMED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_autostart (show other bugs)
Version: 5.24.5
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Nicolas Fella
URL:
Keywords:
: 391609 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-06-05 03:27 UTC by skierpage
Modified: 2025-03-18 22:09 UTC (History)
4 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 2022-06-05 03:27:51 UTC
SUMMARY
I disabled an environment variables "script" in $HOME/.config/plasma-workspace/env/ by renaming it `debug_kscreen.sh_HIDE`. That worked, Plasma startup ignored it. But it still shows up in System Settings > Autostart > Pre-startup Scripts, with no indication that it isn't doing anything.

STEPS TO REPRODUCE
1.  Create an environment variables script test.sh in $HOME/.config/plasma-workspace/env/ containing
   export JUNK_TEST=hello
2. Log out of Plasma desktop session and log back in
3. In a terminal, enter `echo $JUNK_TEST`
4. Rename the file test.sh_HIDE
5. Log out of Plasma desktop session and log back in
6. In a terminal, enter `echo $JUNK_TEST`
7. Look in System Settings > Autostart > Pre-startup Scripts

OBSERVED RESULT
The script sets the environment variable `JUNK_TEST` in Plasma to "hello" when it ends in `.sh`, but doesn't if you rename it. That's good, but it still shows up in Pre-startup Scripts (bad).

EXPECTED RESULT
kcm_autostart could implement a "disabled" state (e.g. gray text or a warning icon) for wrong files with a tooltip "File ignored, does not end in .sh". But it's probably simpler to just not show files that do not end with `.sh`.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.3 on Wayland

ADDITIONAL INFORMATION
It seems these .sh files don't need to be executable and don't need a `#!/bin/sh` starting line.
Bug 171136 and bug 286658 seem related.

I think the mismatch happens because startkde/startplasma.cpp runs
    const auto dirScripts = dir.entryInfoList({QStringLiteral("*.sh")}, QDir::Files, QDir::Name);
but kcms/autostart/autostartmodel.cpp runs
    loadScriptsFromDir(QStringLiteral("plasma-workspace/env/"), AutostartModel::AutostartEntrySource::PlasmaEnvScripts);
and doesn't filter/glob on `*.sh`.
Comment 1 Nate Graham 2022-06-07 00:58:13 UTC
Please feel free to submit a merge request to fix it!
Comment 2 David Edmundson 2025-01-10 19:47:20 UTC
*** Bug 391609 has been marked as a duplicate of this bug. ***