Re: Help for an extension: Call a function when switch workspace in overview



On Tue, Sep 4, 2012 at 1:00 AM, Bazon Bloch <bazonbloch arcor de> wrote:
>
> 2012/9/3 Amy <mathematical coffee gmail com>
>>
>>
>> The above signal fires whenever a workspace is switched, be it via the
>> overview, keybinding, etc.
>>
>> If you only want your function to fire when the overview is open you
>> check whether the overview is visible with `Main.overview.visible`.
>>
>> global.screen.connect('workspace-switched', function () {
>>     if (Main.overview.visible) {
>>         // your function
>>     }
>> });
>
>
> Thanks! (Also @ Jasper St Pierre for correcting the place where to put the
> connect)
> But in fact, now I found out calling the function every time the workspace
> switches is even more useful... :-)
>
>
> Is there a way how to find out which connect events are available? I
> searched /usr/share/gnome-shell/* for a file including "workspace-switched",
> but found nothing.
> Entering global.screen.connect in looking glass didn't help either, and
> unfortunately, I wasn't successful in finding the source code for
> global.screen (that's what I tried as a beginner.)

global.screen is a MetaScreen, so the signal is part of the mutter code.

> (Specific I would be interested in the events:
>  * show overview

Main.overview.connect('showing', function() {
  // ...
});

'hiding' works just as fine.

>  * close a window through the hover x-Button in the overview)

When a window is closed, or only when it's closed from the X button?
'window-removed' from the workspace object would do it, I think. I
can't think of any way to do something only when closing from the X
button in the overview.

>
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list gnome org
> https://mail.gnome.org/mailman/listinfo/gnome-shell-list
>



-- 
  Jasper


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