Reply to topic

Executing Plasma Desktop Scripts within a bash script

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
18657
Karma
83
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.


System Settings and Device Actions KCM maintainer
Image
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
18657
Karma
83
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.


System Settings and Device Actions KCM maintainer
Image
herbiehancock
Registered Member
Posts
4
Karma
0
OS
Thank you very much, bcooksley!
Darkmind
Registered Member
Posts
24
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

 
Reply to topic

Bookmarks



Who is online

Registered users: afiestas, arojas, avishekk, Baidu [Spider], Bing [Bot], bjoernbalazs, Cris70, edmael, einar, epsi1on, Exabot [Bot], ggael, Google [Bot], google01103, Hans, ivan, jgrulich, joshaughnessy, jstaniek, koriun, La Ninje, Majestic-12 [Bot], MSNbot Media, ooker, progdan, scummos, sinclair, Sogou [Bot], TheraHedwig, Tioz, Yahoo [Bot]