Fix removal of the dash on ubuntu enable

This commit is contained in:
Charles Gagnon
2018-10-28 18:18:52 -04:00
parent aa5f7a47e2
commit cf83b8af2e
2 changed files with 34 additions and 30 deletions

View File

@@ -20,6 +20,7 @@
const Me = imports.misc.extensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;
const Overview = Me.imports.overview;
const PanelManager = Me.imports.panelManager;
const Main = imports.ui.main;
@@ -58,6 +59,8 @@ function enable() {
function _enable() {
let ubuntuDock = ExtensionUtils.extensions[UBUNTU_DOCK_UUID];
settings = Convenience.getSettings('org.gnome.shell.extensions.dash-to-panel');
if (ubuntuDock && ubuntuDock.stateObj && ubuntuDock.stateObj.dockManager) {
// Disable Ubuntu Dock
@@ -73,12 +76,11 @@ function _enable() {
}
// ubuntu dock shows the dash when disabled, hide it again if necessary
panelManager.overview.toggleDash();
Overview.toggleDash(settings);
}
if (panelManager) return; //already initialized
settings = Convenience.getSettings('org.gnome.shell.extensions.dash-to-panel');
panelManager = new PanelManager.dtpPanelManager(settings);
panelManager.enable();
@@ -98,7 +100,7 @@ function _enable() {
// Pretend I'm the dash: meant to make appgrd swarm animation come from the
// right position of the appShowButton.
oldDash = Main.overview._dash;
oldDash = Main.overview._dash;
Main.overview._dash = panelManager.primaryPanel.taskbar;
}
@@ -108,7 +110,7 @@ function disable(reset) {
settings.run_dispose();
settings = null;
oldDash=null;
oldDash = null;
panelManager = null;
Main.wm.removeKeybinding('open-application-menu');
@@ -127,4 +129,4 @@ function disable(reset) {
ExtensionSystem.enableExtension(UBUNTU_DOCK_UUID);
}
}
}
}

View File

@@ -53,14 +53,14 @@ var dtpOverview = new Lang.Class({
this._isolation = this._optionalWorkspaceIsolation();
this._optionalHotKeys();
this._optionalNumberOverlay();
this.toggleDash();
this._stockgsKeepDashId = this._dtpSettings.connect('changed::stockgs-keep-dash', () => this.toggleDash());
toggleDash(this._dtpSettings);
this._stockgsKeepDashId = this._dtpSettings.connect('changed::stockgs-keep-dash', () => toggleDash(this._dtpSettings));
},
disable: function () {
this._dtpSettings.disconnect(this._stockgsKeepDashId);
this.toggleDash(true);
toggleDash(this._dtpSettings, true);
// reset stored icon size to the default dash
Main.overview.dashIconSize = Main.overview._controls.dash.iconSize;
@@ -72,27 +72,7 @@ var dtpOverview = new Lang.Class({
this._isolation.disable.apply(this);
},
toggleDash: function(visible) {
// To hide the dash, set its width to 1, so it's almost not taken into account by code
// calculaing the reserved space in the overview. The reason to keep it at 1 is
// to allow its visibility change to trigger an allocaion of the appGrid which
// in turn is triggergin the appsIcon spring animation, required when no other
// actors has this effect, i.e in horizontal mode and without the workspaceThumnails
// 1 static workspace only)
if (visible === undefined) {
visible = this._dtpSettings.get_boolean('stockgs-keep-dash');
}
let visibilityFunc = visible ? 'show' : 'hide';
let width = visible ? -1 : 1;
Main.overview._controls.dash.actor[visibilityFunc]();
Main.overview._controls.dash.actor.set_width(width);
// This force the recalculation of the icon size
Main.overview._controls.dash._maxHeight = -1;
},
/**
* Isolate overview to open new windows for inactive apps
@@ -372,3 +352,25 @@ var dtpOverview = new Lang.Class({
}));
}
});
function toggleDash(settings, visible) {
// To hide the dash, set its width to 1, so it's almost not taken into account by code
// calculaing the reserved space in the overview. The reason to keep it at 1 is
// to allow its visibility change to trigger an allocaion of the appGrid which
// in turn is triggergin the appsIcon spring animation, required when no other
// actors has this effect, i.e in horizontal mode and without the workspaceThumnails
// 1 static workspace only)
if (visible === undefined) {
visible = settings.get_boolean('stockgs-keep-dash');
}
let visibilityFunc = visible ? 'show' : 'hide';
let width = visible ? -1 : 1;
Main.overview._controls.dash.actor[visibilityFunc]();
Main.overview._controls.dash.actor.set_width(width);
// This force the recalculation of the icon size
Main.overview._controls.dash._maxHeight = -1;
}