Re: Which function is called when an app is selected in AppDisplay by hitting the return key?
- From: "Jasper St. Pierre" <jstpierre mecheye net>
- To: Bazon Bloch <bazonbloch arcor de>
- Cc: gnome-shell-list gnome org
- Subject: Re: Which function is called when an app is selected in AppDisplay by hitting the return key?
- Date: Tue, 2 Oct 2012 14:46:53 -0400
On Tue, Oct 2, 2012 at 6:23 AM, Bazon Bloch <bazonbloch arcor de> wrote:
> OK, a new question rises:
> How do I recognize this.metaInfo.id is a contact info and not an app?
Uh, if you're patching the app search provider or subclassing it, that
should never happen.
> If it is an app, everything is fine (e.g. this.metaInfo.id.activate()
> works), but the other case is also needed...
>
>
>
> Am 28.09.2012 22:19, schrieb Jasper St. Pierre:
>>
>> If you're implementing a new search result, the thing that gets passed
>>
>> to you is whatever object that you return from
>> getInitialSearchResults/getSubsequentSearchResults.
>>
>> If you're patching or subclassing AppDisplay, it pushes a ShellApp, so
>> the thing that gets passed to you is that, from which you can call
>> launch() or open_new_window() or a bunch of other things.
>>
>> On Fri, Sep 28, 2012 at 1:31 PM, Bazon Bloch <bazonbloch arcor de> wrote:
>>>
>>> OK, I'm a bit further, but unfortunately, only a bit.
>>> I found out which function is called, when the search result is activated
>>> by
>>> pressing the return key. It's in
>>> /usr/share/gnome-shell/js/ui/searchDisplay.js in the SearchResult Class
>>> the
>>> activate function:
>>>
>>> activate: function() {
>>> this.provider.activateResult(this.metaInfo.id);
>>> Main.overview.toggle();
>>> },
>>>
>>> What I would like to have is something like:
>>>
>>> activate: function() {
>>> if (thisappisoncurrentworkspace) {
>>> [activate this app]
>>> } else {
>>> [open a new window of this app on this workspace]
>>> }
>>> Main.overview.toggle();
>>> },
>>>
>>> I did that before for dash-button-clicks, but there it was easier, as I
>>> have
>>> the app object:
>>> (and I didn't found out, what functions that metaInfo object has...
>>> ..or
>>> just didn't understood it.)
>>>
>>> .....
>>>
>>> let windows = this.app.get_windows();
>>> let activeWorkspace = global.screen.get_active_workspace();
>>> let isoncurrentworkspace=0;
>>>
>>> for (let i = 0; i < windows.length; i++) {
>>> if (windows[i].get_workspace() == activeWorkspace) {
>>> isoncurrentworkspace=1;
>>> }
>>> }
>>>
>>> .....
>>>
>>>
>>> if (isoncurrentworkspace) {
>>> this.app.activate();
>>> } else {
>>> this.app.open_new_window(-1);
>>> }
>>> .......
>>>
>>> How can I get the same result with
>>> activate: function() {
>>> this.provider.activateResult(this.metaInfo.id);
>>> Main.overview.toggle();
>>> },
>>> ?
>>>
>>> Thanks
>>> Bazon
>>>
>>>
>>>
>>> Am 25.09.2012 20:27, schrieb Jasper St. Pierre:
>>>>
>>>> That's because it's a search result. It doesn't activate the button in
>>>>
>>>> that case, it calls activateResult on the search provider.
>>>>
>>>> On Tue, Sep 25, 2012 at 2:24 PM, Bazon Bloch <bazonbloch arcor de>
>>>> wrote:
>>>>>
>>>>> Am 25.09.2012 18:01, schrieb Florian Müllner:
>>>>>
>>>>>> The 'button-press' event is only used for the context menu, activation
>>>>>> is handled in response to the 'clicked' event; that event is emitted
>>>>>> when clicking the StButton (click == button-press + button-release
>>>>>> using the same mouse button). Typing Return/Enter while the StButton
>>>>>> has keyboard focus will emulate a click with the left mouse button.
>>>>>>
>>>>> The strange thing is:
>>>>> There is a difference between left click with mouse and hitting the
>>>>> return
>>>>> key! Just as the user calebtom87 reported here
>>>>>
>>>>> https://extensions.gnome.org/extension/440/workspace-separation-on-dash/
>>>>> ...
>>>>>
>>>>> If you are interested: Steps to reproduce:
>>>>>
>>>>> 1. Install
>>>>>
>>>>> https://extensions.gnome.org/extension/440/workspace-separation-on-dash/
>>>>> (if
>>>>> you're not running Gnome-Shell 3.4 you can try this version with
>>>>> increased
>>>>> compatibility in metadata.json:
>>>>>
>>>>>
>>>>> https://dl.dropbox.com/u/12168886/gnome-shell/workspace_separation_on_dash%40bazonbloch.arcor.de.zip
>>>>> )
>>>>>
>>>>> 2. Open e.g. gedit on first workspace
>>>>>
>>>>> 3. Change to second or any other workspace
>>>>>
>>>>> 4. Hit super and start typing "gedit"
>>>>>
>>>>> 5. (a) Click gedit with your mouse. Result: A new instance of gedit is
>>>>> opened on your current workspace, just as overwritten by the "workspace
>>>>> separation on dash" extension. (in function _onActivate(event))
>>>>>
>>>>> 5. (b) Hit Return while gedit is focussed. Result: You are taken back
>>>>> to
>>>>> the
>>>>> opened instance of gedit on the first workspace, so the overwritten
>>>>> function
>>>>> in "workspace separation on dash" isn't used.
>>>>>
>>>>> So my question, in order to fulfill the user request:
>>>>> What can I do to make case 5(b) like case 5(a)....
>>>>>
>>>>>
>>>>> thanks
>>>>> Bazon
>>>>>
>>>>> _______________________________________________
>>>>> gnome-shell-list mailing list
>>>>> gnome-shell-list gnome org
>>>>> https://mail.gnome.org/mailman/listinfo/gnome-shell-list
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> gnome-shell-list mailing list
>>> gnome-shell-list gnome org
>>> https://mail.gnome.org/mailman/listinfo/gnome-shell-list
>>
>>
>>
>
> _______________________________________________
> 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]