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

Executing Plasma Desktop Scripts within a bash script

Tags: None
(comma "," separated)
Flasher
Registered Member
Posts
3
Karma
0
OS
Hello!

I wrote a small script for my plasma desktop to resize my panels during the start of kde each time a login. I have a dual monitor setup on my laptop so I have to check, which monitors are connected and resize the panels.

My script:
Code: Select all
// Get reference to panel
b = panelById((panelIds[0]))

if(screenGeometry(0).width == 1440) {
  b.length = 1440
  b.height = 37
}
if(screenGeometry(0).width == 1920) {
  b.length = 1920
  //b.height =
}


Documentation I used for writing:
http://techbase.kde.org/KDE_System_Admi ... pScripting

The script works perfectly but don't know any bash command to execute this script within a startup-script during the startup of KDE.

The command
Code: Select all
qdbus org.kde.plasma-desktop /MainApplication loadScriptInInteractiveConsole /path/to/file

only loads the file but didn't execute it. The other methods explain in the tutorial I mentioned above only execute the script one time and didn't execute it each login.

Thanks for your help!

Best regards,

Flasher
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Indeed. It appears that this functionality is unfortunately lacking in Plasma, as run on login scripts definitely could be useful. I would recommend filing a feature request at bugs.kde.org.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
herbiehancock
Registered Member
Posts
4
Karma
0
OS
There is a workaround for running / executing plasma desktop scripts via qdbus. With help of the programm xdotool. Have a look at that 100% automated example script:

http://sidux.com/index.php?name=PNphpBB ... c96#157373

You have to adjust the variable JS_FILE, which has to point to the exact location of your js-plasma-desktop-script, that you want being executed automatically.

Moreover you have to adjust the variable JS_CONSOLE_TITLE. The default language for my kde system is English, therefore I had to set JS_CONSOLE_TITLE this way:
Code: Select all
 JS_CONSOLE_TITLE="Desktop Shell Scripting Console"
herbiehancock
Registered Member
Posts
4
Karma
0
OS
But I have three more questions regarding http://techbase.kde.org/KDE_System_Admi ... ng_Scripts
1) What ist the meaning off $APPDATA ?
In kubuntu 10.10 $APPDATA = /usr/share/kde4/apps/ ?
2) Howto run a script "on first run"?
Do I have to put the script in that directory?
Code: Select all
 /usr/share/kde4/apps/plasma-desktop/init/

3) And howto run a script "on update"?
Just put it in
Code: Select all
 /usr/share/kde4/apps/plasma-desktop/updates/
?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
If /usr/share/kde4/apps/ is included in the list provided by running the following, then you are correct:

kde4-config --path data

As a result, your paths for 2) and 3) are both correct in this case.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
herbiehancock
Registered Member
Posts
4
Karma
0
OS
Thank you very much, bcooksley!
Darkmind
Registered Member
Posts
30
Karma
0
OS
This feature request was submitted more than 1 year ago and it's still not confirmed, as well as no such functionality added

Please, someone vote for it if you find it useful:
https://bugs.kde.org/show_bug.cgi?id=238817


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]