This forum has been archived. All content is frozen. Please use KDE Discuss instead.

kstart and ksystraycmd don't start application minimized

Tags: None
(comma "," separated)
erget
Registered Member
Posts
30
Karma
0
OS
Hello all,

I'm having some difficulties with Miro. I really like the program and I use it for video podcasts, so it's good to have it start automatically when I log on. However, I don't want it to start as a window. It has a system tray icon and when you left click on it, it minimizes it to the tray - optimal for what I want. There's no command line option from Miro itself to get it to start from the system tray, so I used the KDE autostart GUI to set the following option:
kstart --iconify --starthidden miro

It worked a few times, but after a while it stopped starting hidden. If I run the command from the terminal during a session it works fine, but the startup command doesn't start it hidden like I want.
On a sidenote, this seems to be perhaps a general problem with kstart - I tried for a long time to get it to do the exact same thing with BasKet with similar results. Now BasKet has a parameter in the command line that starts it hidden so it's not a problem any more.

With kstart crossed off my list I tried ksystraycmd. From the command line during a session it works just fine, but if I tried it from a script it also started maximized. My parameters:
ksystraycmd --hidden miro

Even though the startups always made just one instance of miro, I've also tried telling KDE to not store its status when shutting down so I always get the fresh instance. No difference.

Any ideas? I'd be really grateful! Thanks a bunch and happy New Year :)
Daniel
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Firstly, you may need to put the full path to the miro binary into System Settings > Startup & Shutdown > Session Management > Applications to be excluded from sessions.

The reason why it stops working is probably because KDE is restoring the application automatically, which in most cases will cause the application to popup if it is already running.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
erget
Registered Member
Posts
30
Karma
0
OS
Alright, I set the session manager to exclude the following applications (I also have it exclude Cairo-Dock):

cairo-dock, /usr/bin/miro

Problem's not gone though. At the moment the parameters in startup are:

kstart --iconify --skiptaskbar --skippager miro
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Can you please examine the command used to start miro on startup? Does it include a "-session" or similar arguments?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
erget
Registered Member
Posts
30
Karma
0
OS
Not sure what you mean - the command I use is listed in my previous post.

Miro allows the following options:

miro --help
Usage: miro.real [options] [torrent files] [video files]

Options:
-h, --help show this help message and exit
--version Print version info.
--theme=<THEME> Theme to use.
--frontend=<FRONTEND>
Frontend to use (widgets, cli, shell).

Settings options:
--list Lists all preferences that can be set by command line.
--set=<PREF> Sets a preference and saves the new value for future
Miro runs. Example: miro --set renderer=gstreamer

Debugging options:
--debug Starts Miro in a gdb session for better debugging.
--unittest Run unittests instead of launching the program.
--convert Command line conversion.
-v Run unittests in verbose mode.
--profile=<FILE> Write profiling information to FILE.
--bias=<BIAS> Set profiling bias to BIAS.
--sync Use X synchronously.
--gconf-name=<NAME>
Use a different name for gconf values than "miro"

The closest I could figure would be the --profile argument, but that seems to be something else.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
If you open System Activity, what is the command used to run the "miro" process in the task list?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
erget
Registered Member
Posts
30
Karma
0
OS
Okay, this is really strange, I just restarted the computer to check (I'd closed miro manually) and miro started just the way I wanted it to.

System Activity tells me the following:
I've got two programs running: miro and miro.real. A search for miro also reveals python. The command used to start it isn't listed when I press Ctrl+Esc.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
If you hover over it, a tooltip is usually shown with the command.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
erget
Registered Member
Posts
30
Karma
0
OS
Ah, the fickle kstart... Sorry about the naive questions. Okay, as I mentioned before I've got three processes that show up when I search for miro. Here they are with their commands:

miro.real: /usr/bin/python, /usr/bin/miro.real
python: /usr/bin/python, /usr/lib64/python2.6/site-packages/miro/dl_daemon/Democracy_Downloader.py
miro: /bin/sh, /usr/bin/miro
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Ok, looks fine. Not sure why it doesn't start it minimized, however given that this behaviour only shows up on logins, perhaps try putting a sleep of 20s or so before running kstart?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
erget
Registered Member
Posts
30
Karma
0
OS
Tried that. The script works fine and launches Miro as it should, but when running at startup miro is nonetheless launched maximized. Very strange. It seems to be a problem with starting up. Is there perhaps a way to force KDE to kill Miro when I log off? Perhaps that'd help.

--Correction--
I've restarted the computer twice since then and both times it seems to have worked correctly. Thanks for the tip! I think the problem's gone... One difference is that when I was still having the problem the autostart option was still in the GUI, but deactivated. I did two things in that session:
1. I changed the path to miro that KDE was supposed to use to ignore Miro when restoring sessions back to the relative path, so without the folders to the actual binary and
2. Deleted the deactivated kstart option in the autostart gui configuration.

Now with the script that sleeps for 20 seconds before starting, it seems to have hit the spot. Thanks so much! :)
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Whilst there is not a way to force KDE to kill it off, there is no reason why KDE Session Management should be restarting Miro on logon. I would recommend disabling autostart and see what happens on login, you may still need to adjust the exception in System Settings.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
erget
Registered Member
Posts
30
Karma
0
OS
Hmm... Yeah, I tried that, but the same problems came back... Currently the sleeping script seems to work though, although I think that it did start up maximized once, since I restored the settings. I was running around quite a bit though and restarting frequently because I was trying some new stuff out. So I'll leave it like this for now - thanks a bunch for the help!

Best,
Daniel


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]