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

About default widget in the desktop

Tags: None
(comma "," separated)
BenNG
Registered Member
Posts
12
Karma
0

About default widget in the desktop

Wed May 23, 2012 5:58 pm
Hi All !

I would like to setup a default kde desktop. For example I would like to add the "weather forecast" widget by default.
Do you know a command which add a widget ?
There are other solution ?

Same for custom shortcuts ...

Thx :)
User avatar
google01103
Manager
Posts
6668
Karma
25
not elegant but if you create the desktop you wish to share just copy the necessary files to the new users - necessary files should be ~/.kde[4]/share/config/plasma*rc

same for shortcuts, they should be ~/.kde[4]/share/config/kglobalshortcutsrc


OpenSuse Leap 42.1 x64, Plasma 5.x

BenNG
Registered Member
Posts
12
Karma
0
yeah ! Excellent :)

I found a way too : This is for Montpellier in France
Code: Select all

function configureWeatherWidgets4Montpellier(widget)
{
widget.writeConfig("Share",false)
widget.writeConfig("pressureUnit",5008)
widget.writeConfig("source","bbcukmet|weather|Montpellier Aeroport Mediterranee, France|http://newsrss.bbc.co.uk/weather/forecast/2648/ObservationsRSS.xml")
widget.writeConfig("speedUnit",9001)
widget.writeConfig("temperatureUnit",6001)
widget.writeConfig("updateInterval",30)
widget.writeConfig("visibilityUnit",2007)
}

activities = activities()
print("there are " + activities.length + " activities")
if(activities){
  for(a in activities){
      activity = activities[a]
      activity.addWidget("weather")
      widgetIdsTab = activity.widgetIds
      if(widgetIdsTab){
   for(w in widgetIdsTab){
    
       widget = activity.widgetById(widgetIdsTab[w])
       print("widget id : "+widget.id)
       print("widget type : "+widget.type)
       if(widget.type === "weather"){
         widget.reloadConfig()
         configureWeatherWidgets4Montpellier(widget)
       }
   }
      }
  }
}



Launch the Desktop Shell Scripting Console ...

Code: Select all
qdbus org.kde.plasma-desktop /MainApplication loadScriptInInteractiveConsole fullPath/to/our/script


... and run it

But it's not 100% automatic so I will probably choose your's :)
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
If you check on Techbase, Administrators and Distributors have the ability to add "first run" setup scripts written in the same javascript you used above.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

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