Re: Unable to get windows list in an extension



On Fri, 2010-11-05 at 09:38 +0100, Thomas Bouffon wrote:
> It works in looking glass, but in the extension (if I restart
> gnome-shell with opened windows) , the windows list is empty. What am
> I doing wrong ?

The extension is loaded before the first window is mapped. What you can
do is either
(1) connect to the 'tracked-windows-changed' signal on
Shell.WindowTracker.get_default()
or
(2) connect to the 'window-added' signal on each workspace

In either case the signal handler will remain active after
"initialization", so if you don't want to apply the filtering to windows
created later on, you will have to disconnect the handler - as there is
(as far as I know) no proper way to tell when the initial startup has
been completed, it will get hacky (unless gnome-session emits a signal
when startup is finished, so that you can disconnect the handlers after
applications have been autostarted) ...

Also note that GNOME Shell will start with a single workspace, so you
will have to create workspaces as necessary as well.

Florian

BTW:
>             args = ['echo',window.get_title()];
>             p = new Shell.Process({ args: args });
>             p.run();

Yikes :-). Easiest way to print to the console:
log(window.get_title());



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]