Re: Setting window properties (always on top, ...) in gnome shell extension
- From: "Jasper St. Pierre" <jstpierre mecheye net>
- To: Giovanni Campagna <scampa giovanni gmail com>
- Cc: gnome-shell-list gnome org
- Subject: Re: Setting window properties (always on top, ...) in gnome shell extension
- Date: Thu, 26 Apr 2012 11:53:19 -0400
On Thu, Apr 26, 2012 at 11:00 AM, Giovanni Campagna
<scampa giovanni gmail com> wrote:
> Il 26 aprile 2012 16:53, Jasper St. Pierre <jstpierre mecheye net> ha scritto:
>> On Thu, Apr 26, 2012 at 6:55 AM, Amy Chan <mathematical coffee gmail com> wrote:
>>> Thank you. I looked into libwnck which does all this stuff from python (now
>>> there's an example of what I wish clutter
>>> had):http://developer.gnome.org/libwnck/stable/WnckWindow.html
>>>
>>> After a bit of experimenting, it turns out in python I can simply do:
>>>
>>> import wnck
>>> wnck.screen_get_default().get_active_window().make_above()
>>>
>>> and that's done!
>>>
>>> So while I wait for the meta_window_set_xxxx stuff to eventually be exposed
>>> to the JS interface, I may experiment with somehow calling a python script
>>> from within JS to do that bit of functionality (I recall seeing this done in
>>> another extension - will have to look it up).
>>>
>>> Or even better, since wnck seems to use the whole gobject introspection
>>> thing, maybe it has JS bindings I can somehow get?
>>
>> const Wnck = imports.gi.Wnck;
>> Wnck.Screen.get_default().get_active_window().make_above();
>>
>> I wonder if we should use more wnck. mutter already depends upon it.
>
> Mutter depends on libwnck? That's strange.
For the alt-tab popup (and maybe other places). I don't know why, but it does:
http://git.gnome.org/browse/mutter/tree/src/ui/tabpopup.c#n846
> Anyway, using libwnck means going to X, changing some property there,
> waiting for an XEvent, and then invoking the appropriate meta_*
> function, incurring on a lot of overhead. The advantage of being in
> the same process as the WM means we can avoid all that.
Fair enough.
Again, mutter doesn't really have a sane API (it's a semi-private
half-duplicated libwnck), and I'm not sure if making it available is
worth the effort.
> Giovanni
>
>>> cheers,
>>> Amy
>>>
>>>
>>> On 24/04/12 13:23, Jasper St. Pierre wrote:
>>>>
>>>> On Mon, Apr 23, 2012 at 11:11 PM, Amy C<mathematical coffee gmail com>
>>>> wrote:
>>>>>
>>>>> Hi all,
>>>>>
>>>>> As part of teaching myself how to make gnome shell extensions, I
>>>>> decided to just add an item to the menu of the panel's title bar that
>>>>> allows the user to select options like always on top/always on this
>>>>> workspace.
>>>>>
>>>>> 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 also seems to do nothing).
>>>>
>>>>
>>>> Ugh. All the MetaWindow properties are all read-only. It seems they
>>>> were only added for the notifies.
>>>>
>>>> Yeah. metacity was originally designed as a process, not a library, so
>>>> it doesn't really do things the way it should. I'm working on making
>>>> metacity/mutter less of a program with an API and more like a library,
>>>> because that's what it should be.
>>>>
>>>>> I could simulate (e.g.) always in this workspace by listening to a
>>>>> workspace changed event and moving the relevant window, but this would
>>>>> not be a "true" implementation in that the window manager still thinks
>>>>> that window.is_on_all_workspaces is false (as I don't seem to be able
>>>>> to set it).
>>>>>
>>>>> So, does anyone know:
>>>>> - an alternate way to set these window properties (properly, as in the
>>>>> window manager knows about it) in a gnome shell extension?
>>>>
>>>>
>>>> There might be some X window properties you can set (but I doubt it,
>>>> and you probably can't do it from JS)
>>>>
>>>>> - how to tell whether a likely function in a c file (e.g.
>>>>> meta_window_set_above) has been exported to the JS interface?
>>>>
>>>>
>>>> Check out /usr/share/gir-1.0/Meta-1.0.gir
>>>>
>>>>> - how to expose a method from the C interface to the JS interface?
>>>>
>>>>
>>>> You have to submit a patch to the C code, and wait a release cycle.
>>>> Unfortunate, I know.
>>>>
>>>>> cheers!
>>>>> _______________________________________________
>>>>> gnome-shell-list mailing list
>>>>> gnome-shell-list gnome org
>>>>> http://mail.gnome.org/mailman/listinfo/gnome-shell-list
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>> --
>> Jasper
>> _______________________________________________
>> gnome-shell-list mailing list
>> gnome-shell-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gnome-shell-list
--
Jasper
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]