Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

As part of teaching myself how to make gnome-shell-extensions, I'd like to be able to tell a window to be on all workspaces on on top of all other windows.

I notice in the mutter API there is a meta_window_set_above in window.c but this doesn't seem to be exposed to the JS interface. Through a bit of trial and error I also seem to be able to call window.set_property('above',true) but this function appears to do nothing (there is a 'title' property I tested on and using set_property on this seems to do nothing).

So, does anyone know of an alternate way to set a window's properties in a gnome shell extension? (and how to tell whether a function in the API gets exposed through javascript? I (naively) thought it'd be as easy as "oh, there's a meta_window_set_above in window.c, so I must be able to call window.set_above(true), but I guess not.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I asked this question of the gnome mailing list - turns out that the meta window properties are all read-only, so I can't (currently) set the above/on all workspaces options using mutter.

However, I can use a library wnck to achieve this. Whilst mutter is still preferred, this may be the only way for now.

Luckily wnck has gobject introspection, so this was sufficient:

const Wnck = imports.gi.Wnck;
let window = Wnck.Screen.get_default().get_active_window();
if ( window ) {
    window.make_above();
}

There are functions make_above, unmake_above, pin, unpin, stick, and unstick (although I don't know what the difference is between pin and stick), all listed here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.