Moving newly created windows



Hi everybody,

I'm trying to write an extension that mimics the smart window positioning of other WMs.

The core of the extension is summarised as:
this._windowCreatedId = display.connect_after('window-created', Lang.bind(this, this._move));

	this._move = function (display, win) {
		/* ... Calculate the new x and y positions of the created window ... */
		win.move_frame(true, x, y);
	}

where the _move function, which calculates the new position of the window and moves it, is fired when the window-created signal is emitted.

Unfortunately this does not work, and I believe it fails because move_frame is called too soon and the window is not there yet. Hence, the window is created at its "default" position, and not at (x, y).

As a workaround, I found that the same procedure works if I add a win.activate(time) before the move_frame action. In such a case the window moves!

However, this hack has its own drawback, in the sense that the new window is positioned on the screen at its "default" position, and only then is moved at (x, y). Such animation looks horrible! (I would have linked a video, but the Gnome-Shell recorder appears to be broken on my system, anyone who can suggest a pipeline for recording to avi while waiting for the webm codec to un-break itself?)

The bottom line: can anybody recommend an approach that allows me to move newly created windows, without the activate hack, and that possibly moves them before they are shown for avoiding the ugly and distracting repositioning?

Thanks a lot,
Alessandro






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