Re: Unable to get windows list in an extension

Thanks for the help !
I managed to write an extension which places the new windows on the workspace I want, and creates the workspace if necessary.
I connected display to  'window-created' because the other signals were emitted to early, and it's not called when the window is moved.
The extension reads a gconf key (/desktop/gnome/shell/windows/
startupworkspaces) in the shape : workspace:string,workspace:string. eg :  1:Firefox,2:Thunderbird . By the way, the counting starts from 0.
If anyone is interested, The extension is attached (I changed the extensio from js to txt because of amil filters).


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

const St =;
const Mainloop = imports.mainloop;
const GConf =;
const Glib =;

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

function FindAndMove() {
 //Lecture de la config
 let gconf = GConf.Client.get_default();
 let chaine_conf=gconf.get_string('/desktop/gnome/shell/windows/startupworkspaces')
 let tableau=chaine_conf.split(',');
  for (let j=0;j<tableau.length; j++) {
    let chaine=tableau[j].split(":");
    let windows = global.get_windows();
        for (let i=0;i<windows.length; i++) {
            let reg1=new RegExp(chaine[1],"g");
            let window = windows[i].get_meta_window();
            if (window.get_title().match(reg1))     {
               for (let j=global.screen.n_workspaces; j<=chaine[0];j++) {
function main() {
            //let workspace = global.screen.get_workspace_by_index(0);

 /*let tracker = Shell.WindowTracker.get_default();
let display = global.screen.get_display();


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