Use panel size to define overview dash height

This commit is contained in:
Charles Gagnon
2022-04-08 22:43:03 -04:00
parent 98e2815e81
commit d37e213fab
2 changed files with 17 additions and 33 deletions

View File

@@ -41,10 +41,7 @@ const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
const Meta = imports.gi.Meta;
const GS_HOTKEYS_KEY = 'switch-to-application-';
const BACKGROUND_MARGIN = 12;
const SMALL_WORKSPACE_RATIO = 0.15;
const DASH_MAX_HEIGHT_RATIO = 0.15;
const DASH_MARGIN = 60;
//timeout names
const T1 = 'swipeEndTimeout';
@@ -56,9 +53,9 @@ var Overview = class {
this._timeoutsHandler = new Utils.TimeoutsHandler();
}
enable (panel) {
this._panel = panel;
this.taskbar = panel.taskbar;
enable (primaryPanel) {
this._panel = primaryPanel;
this.taskbar = primaryPanel.taskbar;
this._injectionsHandler = new Utils.InjectionsHandler();
this._signalsHandler = new Utils.GlobalSignalsHandler();
@@ -71,10 +68,12 @@ var Overview = class {
this._signalsHandler.add([
Me.settings,
'changed::stockgs-keep-dash',
[
'changed::stockgs-keep-dash',
'changed::panel-sizes'
],
() => this._toggleDash()
]);
}
disable() {
@@ -95,9 +94,12 @@ var Overview = class {
}
let visibilityFunc = visible ? 'show' : 'hide';
let height = visible ? -1 : 50; // 50 to preserve some spacing
let height = -1;
let overviewControls = Main.overview._overview._controls;
if (!visible && this._panel.geom.position == St.Side.BOTTOM)
height = this._panel.geom.h + DASH_MARGIN
overviewControls.dash.actor[visibilityFunc]();
overviewControls.dash.actor.set_height(height);
}

View File

@@ -362,8 +362,6 @@ var Panel = GObject.registerClass({
}
]);
this._setSearchEntryOffset(this.geom.w);
if (this.statusArea.dateMenu) {
this._formatVerticalClock();
@@ -407,7 +405,6 @@ var Panel = GObject.registerClass({
this.menuManager._changeMenu = this.menuManager._oldChangeMenu;
this._myPanelGhost.get_parent().remove_actor(this._myPanelGhost);
this._setSearchEntryOffset(0);
panelBoxes.forEach(b => delete this[b].allocate);
this._unmappedButtons.forEach(a => this._disconnectVisibleId(a));
@@ -707,20 +704,6 @@ var Panel = GObject.registerClass({
this._myPanelGhost.set_size(this.width, this.checkIfVertical() ? 1 : this.height);
}
_setSearchEntryOffset(offset) {
if (this.isPrimary) {
//In the overview, when the panel is vertical the search-entry is the only element
//that doesn't natively take into account the size of a side dock, as it is always
//centered relatively to the monitor. This looks misaligned, adjust it here so it
//is centered like the rest of the overview elements.
let paddingSide = this.getPosition() == St.Side.LEFT ? 'left' : 'right';
let scaleFactor = Utils.getScaleFactor();
let style = offset ? 'padding-' + paddingSide + ':' + (offset / scaleFactor) + 'px;' : null;
let searchEntry = Main.overview._overview._controls._searchEntry;
searchEntry.get_parent().set_style(style);
}
}
_adjustForOverview() {
let isFocusedMonitor = this.panelManager.checkIfFocusedMonitor(this.monitor);
let isOverview = !!Main.overview.visibleTarget;
@@ -752,7 +735,6 @@ var Panel = GObject.registerClass({
if (this.checkIfVertical()) {
this.showAppsIconWrapper.realShowAppsIcon.toggleButton.set_width(this.geom.w);
this._refreshVerticalAlloc();
this._setSearchEntryOffset(this.geom.w);
}
}
@@ -832,11 +814,11 @@ var Panel = GObject.registerClass({
}
return {
x: x, y: y,
w: w, h: h,
lrPadding: lrPadding,
tbPadding: tbPadding,
position: position
x, y,
w, h,
lrPadding,
tbPadding,
position
};
}