Sorry for making yet another topic about this, but nothing I try myself or have been suggested to try works, and I very much feel as if nobody is seeing my previous threads.
I’ve tried to search the KDE Plasma GitHub repository for “autostart”, but it oddly finds nothing at all. But even if that found something, I suspect that it won’t be as straight-forward as I hope. I have a very difficult time reading others’ source code.
All I’m trying to figure out is what exact command that KDE Plasma’s “autostart” mechanism uses in front of the “Exec” command when it executes those autostart entries. Most likely something with kstart5
, but it’s definitely not this:
setsid -f kstart5 -- ACTUAL_COMMAND >/dev/null 2>&1 &
… because that (like every other command I’ve tried, including simply ACTUAL_COMMAND &
) randomly/mostly causes the orange highlight annoyance which I’m trying to avoid, and which only happens when I or my scripts run commands – not when KDE Plasma itself gets to run those autostart entries. So they must be doing something special to avoid this.
How can one find this out for sure? I feel as if I’m losing my mind here…
There is no magic --no-orange-thing
argument anywhere.
In fact there’s no particular “command” for autostart, it’s just executing the program and arguments as they are specified in the autostart desktop file
But then why the different behaviour in how they start as far as KDE Plasma is concerned? Why the random orange highlight?
My guess would be that it’s related to using setsid
. Does it happen when not using that?
Generally the taskbar turning orange happens in two cases.
-
The application is “demanding attention” (_NET_WM_STATE_DEMANDS_ATTENTION in X11 terms)
-
The application tried to activate its window, but the window manager denied it due to focus stealing prevention.
Well, the setsid
stuff is required for the “child” program to not exit as soon as the “parent” program (script) finishes…
Well, turns out your idea was right. I’ve just made a large number of experiments by trying these commands many times in a test script:
1: exec('kstart5 -- krita >/dev/null 2>&1 &');
2: exec('setsid -f kstart5 -- krita >/dev/null 2>&1 &');
I first run the PHP CLI script. Then, as soon as the Krita splash screen displays, I click on the text editor behind it in order to simulate “other programs starting and stealing focus”.
With command #1, it consistently (at least over numerous different attempts) does NOT show the orange highlight. But command #2 (the one I’m forced to use) almost consistently (sometimes not) shows the orange highlight…
So… yeah. It must be due to the setsid -f
. But it’s not like I use that “for fun”. It took me ages to figure out that it was needed for the parent to not kill the child process. If I leave it out, all my programs will just exit once the starter script finishes. (This made me extremely puzzled a while ago before I realized what was happening.)
Will I really need to make some sort of “dummy Bash script” which I call from my PHP CLI script just to get around having to use setsid -f
, in order to avoid the annoying orange highlights? I wouldn’t know how to make such a script…