Page 1 of 1

[SOLVED]How to use kstart properly

PostPosted: Nov 5th, '15, 10:22
by davidmageia
Hi,

I would like to write a very simple script which could launch my favorite software when I start to work like : firefox, dolphin, zim...
But I would like that each software open in the right virtual desktop.
But for example,
Code: Select all
kstart --desktop 2 chromium-browser &


does not open chromium in the desktop 2 but in the 1.
Ths is not the case with
Code: Select all
kstart --desktop 2 dolphin &

It opens in the desktop 2, even if I launch the command in the desktop 1.

It does not work also for firefox, birdie...

Do I need to add something in the kstart command ? I would like to launch simultaneously 4-5 software.

Re: How to use kstart properly

PostPosted: Nov 5th, '15, 19:56
by doktor5000
the help seems to recommend providing either window title or class:
kstart --help wrote:
Code: Select all
  --window <regexp>         A regular expression matching the window title
  --windowclass <class>     A string matching the window class (WM_CLASS property)
                            The window class can be found out by running
                            'xprop | grep WM_CLASS' and clicking on a window
                            (use either both parts separated by a space or only the right part).
                            NOTE: If you specify neither window title nor window class,
                            then the very first window to appear will be taken;
                            omitting both options is NOT recommended.



That may be a dumb question, but why hardcode the desktop in the script? I usually do that via the kwin settings.
Right-click on the window title => advanced => special settings for this window (or program depending what you want)

See e.g. https://userbase.kde.org/KWin_Rules_Examples or https://userbase.kde.org/KWin_Rules for more details.

You could also try with wmctrl or this: http://kde-apps.org/content/show.php/WM ... tent=40425

Re: How to use kstart properly

PostPosted: Nov 5th, '15, 20:36
by alf
davidmageia wrote:I would like to write a very simple script

Why writing a script, that can be done in KDE's autostart directly. See the screenshots.
davidmageia wrote:does not open chromium in the desktop 2 but in the 1.

You have at least to pass the window title like this example
Code: Select all
kstart  --desktop 2 --window "Mozilla Firefox" firefox


Bildschirmfoto2.png
Bildschirmfoto2.png (35.56 KiB) Viewed 1729 times

Bildschirmfoto3.png
Bildschirmfoto3.png (65.3 KiB) Viewed 1729 times

Re: How to use kstart properly

PostPosted: Nov 25th, '15, 09:57
by davidmageia
Thank you.
It works by adding "--window "Name of the software"".
And thank you for the tips on Kde which I did not know (even I prefer to write my own script...).