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 <bazonbl...@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 <bazonbl...@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 -- Jasper _______________________________________________ gnome-shell-list mailing list gnome-shell-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-shell-list