Unable to get windows list in an extension



Hi,
I'm trying to plpay with window postions in an extension.
i wrote something simple :

// Sample extension code, makes clicking on the panel show a message

const St = imports.gi.St;
const Mainloop = imports.mainloop;

const Main = imports.ui.main;
const Shell = imports.gi.Shell;

// Put your extension initialization code here
function main() {
//    Main.panel.actor.connect('button-release-event', _showHello);
    //let windows = Shell.Global.get().get_windows();
    let windows = global.get_windows();


        for (let i=0;i<windows.lentgh; i++) {


            reg1=new RegExp("[underbi]","g");
            let window = windows[i].get_meta_window();
            args = ['echo',window.get_title()];
            p = new Shell.Process({ args: args });
            p.run();

            if (window.get_title().match(reg1))     {
               window.change_workspace_by_index(2,True,global.get_current_time());
            }
         } 
}

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 ?

Thaks in advance,
Thomas


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