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



On Sun, Sep 2, 2012 at 2:50 PM, Bazon Bloch <bazonbloch arcor de> wrote:
> Many many thanks, that's it! :-)
>
> (I supposed it's right I put it in the init function of the extension....
> ...at least it works.)

You should connect to it in your enable function, and disconnect from
it in your disable function.

> Am 02.09.2012 20:39, schrieb Jasper St. Pierre:
>
>> (CCing gnome-shell-list, please try to reply on-list)
>>
>> On Sun, Sep 2, 2012 at 2:35 PM, Bazon Bloch <bazonbloch arcor de> wrote:
>>>
>>> Sorry, maybe my subject line was confusing (and so I changed it):
>>> I don't want to change the workspace, I want to call a self written
>>> function
>>> when the event "switching workspaces in overview mode" occurs.
>>>
>>> (maybe by monkey-patching an existing function and just adding the call
>>> of
>>> the self written function to the original function in the patch.)
>>>
>>> I just don't find the corresponding function which is called when
>>> switching
>>> workspaces in the overview: is it in overview.js, workspaces.js,
>>> workspacesView.js, workspaceThumbnails.js? or main.js?
>>
>> Aha, what you want to do is connect to the screen's workspace-switched
>> signal.
>>
>> global.screen.connect('workspace-switched', function() {
>>      log('workspace switched!');
>> });
>>
>>> Am 02.09.2012 20:19, schrieb Jasper St. Pierre:
>>>>
>>>> On Sun, Sep 2, 2012 at 10:29 AM, Bazon Bloch <bazonbloch arcor de>
>>>> wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> I'm about to write a Gnome-Shell-Extension and by now, everything is
>>>>> fine,
>>>>> except one thing:
>>>>>
>>>>> I need to call a function when the workspaces switch in the overview.
>>>>>
>>>>> I tried with Main.wm.actionMoveWorkspaceUp, but that is only for
>>>>> workspace
>>>>> change outside the overview.
>>>>> So what can I do to get a function when switching workspaces IN the
>>>>> overview?
>>>>
>>>> You can just activate the workspace directly.
>>>>
>>>>
>>>>
>>>> global.screen.get_workspace_by_index(index).activate(global.get_current_time());
>>>>
>>>>> thanks!
>>>>>
>>>>> _______________________________________________
>>>>> 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]