diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml index 40b568e..f0591fd 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -245,6 +245,14 @@ Lock the taskbar Specifies if the user can modify the taskbar + + 0 + Panel top and bottom margins + + + 0 + Panel side margins + false Override theme background color @@ -736,16 +744,6 @@ App icon margin Set the margin for application icons in the embedded dash. - - 0 - App icon margin to desktop - Set the margin for application icons in the embedded dash towards the desktop (top margin if panel is on the bottom). - - - 0 - App icon margin to screen border - Set the margin for application icons in the embedded dash towards the desktop (bottom margin if panel is on the bottom). - 4 App icon padding diff --git a/src/appIcons.js b/src/appIcons.js index 340b6cd..848393d 100644 --- a/src/appIcons.js +++ b/src/appIcons.js @@ -844,23 +844,11 @@ export const TaskbarAppIcon = GObject.registerClass( _setAppIconPadding() { const padding = getIconPadding(this.dtpPanel.monitor.index) const margin = SETTINGS.get_int('appicon-margin') - const margin_todesktop = SETTINGS.get_int('appicon-margin-todesktop') - const margin_toscreenborder = SETTINGS.get_int( - 'appicon-margin-toscreenborder', - ) + let vertical = this.dtpPanel.checkIfVertical() - let margin_style = '' - const panelPosition = this.dtpPanel.getPosition() - if (panelPosition == St.Side.TOP) { - margin_style = `${margin_toscreenborder}px ${margin}px ${margin_todesktop}px ${margin}px` - } else if (panelPosition == St.Side.RIGHT) { - margin_style = `${margin}px ${margin_toscreenborder}px ${margin}px ${margin_todesktop}px` - } else if (panelPosition == St.Side.LEFT) { - margin_style = `${margin}px ${margin_todesktop}px ${margin}px ${margin_toscreenborder}px` - } else { - margin_style = `${margin_todesktop}px ${margin}px ${margin_toscreenborder}px ${margin}px` - } - this.set_style(`padding: ${margin_style};`) + this.set_style( + `padding: ${vertical ? margin : 0}px ${vertical ? 0 : margin}px;`, + ) this._iconContainer.set_style('padding: ' + padding + 'px;') } diff --git a/src/panel.js b/src/panel.js index 4d947fc..0de5f2b 100644 --- a/src/panel.js +++ b/src/panel.js @@ -219,6 +219,7 @@ export const Panel = GObject.registerClass( this.geom = this.getGeometry() + this._setPanelBoxStyle() this._setPanelPosition() if (!this.isStandalone) { @@ -575,9 +576,9 @@ export const Panel = GObject.registerClass( [ SETTINGS, [ + 'changed::panel-side-margins', + 'changed::panel-top-bottom-margins', 'changed::panel-sizes', - 'changed::appicon-margin-todesktop', - 'changed::appicon-margin-toscreenborder', 'changed::group-apps', ], (settings, settingChanged) => { @@ -678,6 +679,7 @@ export const Panel = GObject.registerClass( } _resetGeometry() { + this._setPanelBoxStyle() this.geom = this.getGeometry() this._setPanelPosition() this.taskbar.resetAppIcons(true) @@ -698,9 +700,8 @@ export const Panel = GObject.registerClass( getGeometry() { let scaleFactor = Utils.getScaleFactor() let panelBoxTheme = this.panelBox.get_theme_node() - let lrPadding = - panelBoxTheme.get_padding(St.Side.RIGHT) + - panelBoxTheme.get_padding(St.Side.LEFT) + let leftPadding = panelBoxTheme.get_padding(St.Side.LEFT) + let lrPadding = leftPadding + panelBoxTheme.get_padding(St.Side.RIGHT) let topPadding = panelBoxTheme.get_padding(St.Side.TOP) let tbPadding = topPadding + panelBoxTheme.get_padding(St.Side.BOTTOM) let position = this.getPosition() @@ -718,10 +719,7 @@ export const Panel = GObject.registerClass( let w = 0, h = 0 - const panelSize = - PanelSettings.getPanelSize(SETTINGS, this.monitor.index) + - SETTINGS.get_int('appicon-margin-todesktop') + - SETTINGS.get_int('appicon-margin-toscreenborder') + const panelSize = PanelSettings.getPanelSize(SETTINGS, this.monitor.index) this.dtpSize = panelSize * scaleFactor if ( @@ -762,7 +760,7 @@ export const Panel = GObject.registerClass( y = this.monitor.y + gsTopPanelOffset } else { //BOTTOM - x = this.monitor.x + x = this.monitor.x - leftPadding y = this.monitor.y + this.monitor.height - this.dtpSize - tbPadding } @@ -984,10 +982,7 @@ export const Panel = GObject.registerClass( box[this.varCoord.c1] = tl box[this.varCoord.c2] = br - panelAlloc[this.varCoord.c2] = Math.min( - dynamicGroup.size, - panelAlloc[this.varCoord.c2], - ) + panelAlloc[this.varCoord.c2] = Math.min(dynamicGroup.size, br - tl) } this.set_allocation(box) @@ -1040,6 +1035,15 @@ export const Panel = GObject.registerClass( } } + _setPanelBoxStyle() { + let topBottomMargins = SETTINGS.get_int('panel-top-bottom-margins') + let sideMargins = SETTINGS.get_int('panel-side-margins') + + this.panelBox.set_style( + `padding: ${topBottomMargins}px ${sideMargins}px;`, + ) + } + _setPanelPosition() { let clipContainer = this.panelBox.get_parent() diff --git a/src/prefs.js b/src/prefs.js index bca7d90..fb502f0 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -237,8 +237,8 @@ const Preferences = class { this._leftbox_size_timeout = 0 this._globalBorderRadius_margin_timeout = 0 this._appicon_margin_timeout = 0 - this._appicon_margin_todesktop_timeout = 0 - this._appicon_margin_toscreenborder_timeout = 0 + this._panel_top_bottom_margins_timeout = 0 + this._panel_side_margins_timeout = 0 this._appicon_padding_timeout = 0 this._opacity_timeout = 0 this._tray_padding_timeout = 0 @@ -835,12 +835,12 @@ const Preferences = class { return value + ' px' }) this._builder - .get_object('appicon_margin_todesktop_scale') + .get_object('panel_top_bottom_margins_scale') .set_format_value_func((scale, value) => { return value + ' px' }) this._builder - .get_object('appicon_margin_toscreenborder_scale') + .get_object('panel_side_margins_scale') .set_format_value_func((scale, value) => { return value + ' px' }) @@ -3114,13 +3114,13 @@ const Preferences = class { range: DEFAULT_MARGIN_SIZES, }, { - objectName: 'appicon_margin_todesktop_scale', - valueName: 'appicon-margin-todesktop', + objectName: 'panel_top_bottom_margins_scale', + valueName: 'panel-top-bottom-margins', range: DEFAULT_MARGIN_SIZES, }, { - objectName: 'appicon_margin_toscreenborder_scale', - valueName: 'appicon-margin-toscreenborder', + objectName: 'panel_side_margins_scale', + valueName: 'panel-side-margins', range: DEFAULT_MARGIN_SIZES, }, { @@ -3847,41 +3847,42 @@ const BuilderScope = GObject.registerClass( ) } - appicon_margin_todesktop_scale_value_changed_cb(scale) { + panel_top_bottom_margins_scale_value_changed_cb(scale) { // Avoid settings the size consinuosly - if (this._preferences._appicon_margin_todesktop_timeout > 0) - GLib.Source.remove(this._preferences._appicon_margin_todesktop_timeout) + if (this._preferences._panel_top_bottom_margins_timeout > 0) + GLib.Source.remove(this._preferences._panel_top_bottom_margins_timeout) - this._preferences._appicon_margin_todesktop_timeout = GLib.timeout_add( + this._preferences._panel_top_bottom_margins_timeout = GLib.timeout_add( GLib.PRIORITY_DEFAULT, SCALE_UPDATE_TIMEOUT, () => { this._preferences._settings.set_int( - 'appicon-margin-todesktop', + 'panel-top-bottom-margins', scale.get_value(), ) - this._preferences._appicon_margin_todesktop_timeout = 0 + this._preferences._panel_top_bottom_margins_timeout = 0 return GLib.SOURCE_REMOVE }, ) } - appicon_margin_toscreenborder_scale_value_changed_cb(scale) { + panel_side_margins_scale_value_changed_cb(scale) { // Avoid settings the size consinuosly - if (this._preferences._appicon_margin_toscreenborder_timeout > 0) - GLib.Source.remove( - this._preferences._appicon_margin_toscreenborder_timeout, - ) + if (this._preferences._panel_side_margins_timeout > 0) + GLib.Source.remove(this._preferences._panel_side_margins_timeout) - this._preferences._appicon_margin_toscreenborder_timeout = - GLib.timeout_add(GLib.PRIORITY_DEFAULT, SCALE_UPDATE_TIMEOUT, () => { + this._preferences._panel_side_margins_timeout = GLib.timeout_add( + GLib.PRIORITY_DEFAULT, + SCALE_UPDATE_TIMEOUT, + () => { this._preferences._settings.set_int( - 'appicon-margin-toscreenborder', + 'panel-side-margins', scale.get_value(), ) - this._preferences._appicon_margin_toscreenborder_timeout = 0 + this._preferences._panel_side_margins_timeout = 0 return GLib.SOURCE_REMOVE - }) + }, + ) } appicon_padding_scale_value_changed_cb(scale) { diff --git a/ui/SettingsStyle.ui b/ui/SettingsStyle.ui index aabe0a3..3ef051f 100644 --- a/ui/SettingsStyle.ui +++ b/ui/SettingsStyle.ui @@ -86,40 +86,6 @@ - - - (default is 0) - App Icon Margin Towards Desktop - - - appicon_margin_todesktop_adjustment - 0 - True - 0 - right - 300 - - - - - - - - (default is 0) - App Icon Margin Towards Screen Border - - - appicon_margin_toscreenborder_adjustment - 0 - True - 0 - right - 300 - - - - - (default is 4) @@ -297,6 +263,44 @@ Panel style + + + (default is 0) + Side margins + + + appicon_margin_todesktop_adjustment + 0 + True + 0 + right + 300 + + + + + + + + (default is 0) + Top and bottom margins + + + appicon_margin_toscreenborder_adjustment + 0 + True + 0 + right + 300 + + + + + + + + + Override panel theme background color @@ -312,10 +316,6 @@ - - - - Override panel theme background opacity