Write to AppletGlobals in plasma-desktop-appletsrc with Javascript

2010-04-25 Thread Antony Loebs
I've been messing around with ways to script the appearance of KDE and found
Kubuntu's
01-kubuntu-default-setup.js script, which (quite nicely) shows me how to do
what I want. However, I've run into a problem with the pager; I would like
the default to be one row, instead of two. I dutifully added:
---
pager = panel.addWidget("pager");
pager.writeConfig("rows", "1");
---
to the script, but this didn't work. On closer inspection, I found that the
pager looks for something like this:
---
[AppletGlobals][plasma_applet_pager]
rows=1
---
So what would the command be to write that to plasma-desktop-appletsrc?
Thanks!
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: Write to AppletGlobals in plasma-desktop-appletsrc with Javascript

2010-04-25 Thread Aaron J. Seigo
On April 25, 2010, Antony Loebs wrote:
> So what would the command be to write that to plasma-desktop-appletsrc?
> Thanks!

currently there isn't any way to do this in 4.4. in 4.5 you will be able to 
use read/writeGlobalConfig to do so.

in any case, the # of rows of the pager is being moved to the window manager 
where it really belongs (to follow the internal layout of virtual desktops / 
viewports according to the WM), so even in this case it probably won't work 
for very much longer.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: Write to AppletGlobals in plasma-desktop-appletsrc with Javascript

2010-04-25 Thread Antony Loebs
On Sun, Apr 25, 2010 at 3:08 PM, Aaron J. Seigo  wrote:

>  currently there isn't any way to do this in 4.4. in 4.5 you will be able
> to use read/writeGlobalConfig to do so.
>
> in any case, the # of rows of the pager is being moved to the window
> manager where it really belongs (to follow the internal layout of virtual
> desktops / viewports according to the WM), so even in this case it probably
> won't work for very much longer.
>

Pity. Would it be possible to brute-force it some other way? For example, at
the beginning of the script, to do something like:
---
var fh = fopen("~/.kde/share/config/plasma-desktop-appletsrc", 3)
fwrite(fh, "[AppletGlobals][plasma_applet_pager]\nrows=1");
fclose(fh);
---
(This doesn't work, btw, since plasma-desktop complains about fopen, but
it's just to make my meaning clear.)

Also, on a somewhat related note, I've discovered that some applets start
too quickly. :) For example, take the example of the quicklaunch applet. In
the script, I have:
---
qlaunch = panel.addWidget("quicklaunch");
qlaunch.writeConfig("iconSize", "24");
qlaunch.writeConfig("iconUrls",
"file:///usr/share/applications/firefox.desktop");
---
However, when quicklaunch starts, it displays the default Konqueror,
Dolphin, and Kopete icons at size 16. If I go back and insert the lines into
plasma-desktop-appletsrc, it works. Additionally, for some applets
(Lancelot, yaWP), I don't have to even edit anything; if I just restart
plasma-desktop, they then display correctly. From this I conclude that it's
a matter of the applets trying to read the configuration file before their
configurations are written. Any suggestions on how to overcome this; perhaps
a way to write the configuration first, and then start the applet?

Thanks!
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: Write to AppletGlobals in plasma-desktop-appletsrc with Javascript

2010-04-25 Thread Aaron J. Seigo
On April 25, 2010, Antony Loebs wrote:
> On Sun, Apr 25, 2010 at 3:08 PM, Aaron J. Seigo  wrote:
> >  currently there isn't any way to do this in 4.4. in 4.5 you will be able
> > 
> > to use read/writeGlobalConfig to do so.
> > 
> > in any case, the # of rows of the pager is being moved to the window
> > manager where it really belongs (to follow the internal layout of virtual
> > desktops / viewports according to the WM), so even in this case it
> > probably won't work for very much longer.
> 
> Pity. Would it be possible to brute-force it some other way? For example,
> at the beginning of the script, to do something like:
> ---
> var fh = fopen("~/.kde/share/config/plasma-desktop-appletsrc", 3)
> fwrite(fh, "[AppletGlobals][plasma_applet_pager]\nrows=1");
> fclose(fh);
> ---
> (This doesn't work, btw, since plasma-desktop complains about fopen, but
> it's just to make my meaning clear.)

the scripting API does not allow opening of random files. all the access goes 
through existing plasma API to ensure that it's always correct and in sync 
with what the plasma based application expects. one of the requirements of the 
scripting API is that it produces results that work, and so there are some 
constraints such as this one.

> Also, on a somewhat related note, I've discovered that some applets start
> too quickly. :) 

it's not that they are starting too quickly, it's that they haven't 
implemented Plasmsa::Applet::configChanged(). we've gone through and fixed the 
ones in svn for 4.5 (with a few outstanding ones left, e.g. folderview.. but 
those will also get done..)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel