Add a FocusApp method to org.gnome.Shell
This method, which accepts a .desktop filename, is used to highlight a specific application in the overview, for example because it has just been created or installed. https://bugzilla.gnome.org/show_bug.cgi?id=654086
This commit is contained in:
parent
bed653737b
commit
415563dc6e
@ -108,8 +108,38 @@ const AlphabeticalView = new Lang.Class({
|
||||
continue;
|
||||
this._grid.addItem(this._items[id].actor);
|
||||
}
|
||||
|
||||
this.emit('view-loaded');
|
||||
},
|
||||
|
||||
_selectAppInternal: function(id) {
|
||||
if (this._items[id])
|
||||
this._items[id].actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||
else
|
||||
log('No such application ' + id);
|
||||
},
|
||||
|
||||
selectApp: function(id) {
|
||||
if (this._items[id] && this._items[id].actor.mapped) {
|
||||
this._selectAppInternal(id);
|
||||
} else if (this._items[id]) {
|
||||
// Need to wait until the view is mapped
|
||||
let signalId = this._items[id].actor.connect('notify::mapped', Lang.bind(this, function(actor) {
|
||||
if (actor.mapped) {
|
||||
actor.disconnect(signalId);
|
||||
this._selectAppInternal(id);
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
// Need to wait until the view is built
|
||||
let signalId = this.connect('view-loaded', Lang.bind(this, function() {
|
||||
this.disconnect(signalId);
|
||||
this.selectApp(id);
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(AlphabeticalView.prototype);
|
||||
|
||||
const FolderView = new Lang.Class({
|
||||
Name: 'FolderView',
|
||||
@ -509,7 +539,12 @@ const AppDisplay = new Lang.Class({
|
||||
if (focused)
|
||||
this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
selectApp: function(id) {
|
||||
this._showView(Views.ALL);
|
||||
this._views[Views.ALL].view.selectApp(id);
|
||||
},
|
||||
});
|
||||
|
||||
const AppSearchProvider = new Lang.Class({
|
||||
|
@ -265,7 +265,7 @@ const Overview = new Lang.Class({
|
||||
// Create controls
|
||||
this._controls = new OverviewControls.ControlsManager(this._searchEntry);
|
||||
this._dash = this._controls.dash;
|
||||
this._viewSelector = this._controls.viewSelector;
|
||||
this.viewSelector = this._controls.viewSelector;
|
||||
|
||||
// Add our same-line elements after the search entry
|
||||
this._overview.add(this._controls.actor, { y_fill: true, expand: true });
|
||||
@ -285,11 +285,11 @@ const Overview = new Lang.Class({
|
||||
},
|
||||
|
||||
addSearchProvider: function(provider) {
|
||||
this._viewSelector.addSearchProvider(provider);
|
||||
this.viewSelector.addSearchProvider(provider);
|
||||
},
|
||||
|
||||
removeSearchProvider: function(provider) {
|
||||
this._viewSelector.removeSearchProvider(provider);
|
||||
this.viewSelector.removeSearchProvider(provider);
|
||||
},
|
||||
|
||||
//
|
||||
@ -513,7 +513,7 @@ const Overview = new Lang.Class({
|
||||
this._activationTime = Date.now() / 1000;
|
||||
|
||||
Meta.disable_unredirect_for_screen(global.screen);
|
||||
this._viewSelector.show();
|
||||
this.viewSelector.show();
|
||||
|
||||
this._stack.opacity = 0;
|
||||
Tweener.addTween(this._stack,
|
||||
@ -620,7 +620,7 @@ const Overview = new Lang.Class({
|
||||
this.animationInProgress = true;
|
||||
this.visibleTarget = false;
|
||||
|
||||
this._viewSelector.zoomFromOverview();
|
||||
this.viewSelector.zoomFromOverview();
|
||||
|
||||
// Make other elements fade out.
|
||||
Tweener.addTween(this._stack,
|
||||
@ -655,7 +655,7 @@ const Overview = new Lang.Class({
|
||||
// Re-enable unredirection
|
||||
Meta.enable_unredirect_for_screen(global.screen);
|
||||
|
||||
this._viewSelector.hide();
|
||||
this.viewSelector.hide();
|
||||
this._desktopFade.hide();
|
||||
this._coverPane.hide();
|
||||
|
||||
|
@ -13,6 +13,7 @@ const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Hash = imports.misc.hash;
|
||||
const Main = imports.ui.main;
|
||||
const Screenshot = imports.ui.screenshot;
|
||||
const ViewSelector = imports.ui.viewSelector;
|
||||
|
||||
const GnomeShellIface = <interface name="org.gnome.Shell">
|
||||
<method name="Eval">
|
||||
@ -24,6 +25,9 @@ const GnomeShellIface = <interface name="org.gnome.Shell">
|
||||
<method name="ShowOSD">
|
||||
<arg type="a{sv}" direction="in" name="params"/>
|
||||
</method>
|
||||
<method name="FocusApp">
|
||||
<arg type="s" direction="in" name="id"/>
|
||||
</method>
|
||||
<method name="GrabAccelerator">
|
||||
<arg type="s" direction="in" name="accelerator"/>
|
||||
<arg type="u" direction="in" name="flags"/>
|
||||
@ -135,6 +139,14 @@ const GnomeShell = new Lang.Class({
|
||||
Main.osdWindow.show();
|
||||
},
|
||||
|
||||
FocusApp: function(id) {
|
||||
let overview = Main.overview;
|
||||
|
||||
overview.show();
|
||||
overview.viewSelector.setActivePage(ViewSelector.ViewPage.APPS);
|
||||
overview.viewSelector.appDisplay.selectApp(id);
|
||||
},
|
||||
|
||||
GrabAcceleratorAsync: function(params, invocation) {
|
||||
let [accel, flags] = params;
|
||||
let sender = invocation.get_sender();
|
||||
|
@ -95,8 +95,8 @@ const ViewSelector = new Lang.Class({
|
||||
this._workspacesPage = this._addPage(this._workspacesDisplay.actor,
|
||||
_("Windows"), 'emblem-documents-symbolic');
|
||||
|
||||
this._appDisplay = new AppDisplay.AppDisplay();
|
||||
this._appsPage = this._addPage(this._appDisplay.actor,
|
||||
this.appDisplay = new AppDisplay.AppDisplay();
|
||||
this._appsPage = this._addPage(this.appDisplay.actor,
|
||||
_("Applications"), 'view-grid-symbolic');
|
||||
|
||||
this._searchResults = new SearchDisplay.SearchResults(this._searchSystem);
|
||||
@ -525,6 +525,13 @@ const ViewSelector = new Lang.Class({
|
||||
return ViewPage.SEARCH;
|
||||
},
|
||||
|
||||
setActivePage: function(page) {
|
||||
if (page == ViewPage.WINDOWS)
|
||||
this._showPage(this._workspacesPage);
|
||||
else
|
||||
this._showPage(this._appsPage);
|
||||
},
|
||||
|
||||
fadeIn: function() {
|
||||
let actor = this._activePage;
|
||||
Tweener.addTween(actor, { opacity: 255,
|
||||
|
Loading…
Reference in New Issue
Block a user