Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions Settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,46 @@
</property>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="dock_margin_size_listboxrow">
<property name="child">
<object class="GtkGrid" id="dock_margin_size_grid">
<property name="can_focus">0</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="dock_margin_size_label">
<property name="can_focus">0</property>
<property name="label" translatable="yes">Dock margin size</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkScale" id="dock_margin_size_scale">
<property name="draw-value">1</property>
<property name="valign">baseline</property>
<property name="hexpand">1</property>
<property name="adjustment">dock_margin_size_adjustment</property>
<property name="round_digits">0</property>
<property name="digits">0</property>
<property name="value_pos">right</property>
<signal name="value-changed" handler="dock_margin_size_value_changed_cb" />
<layout>
<property name="column">1</property>
<property name="row">0</property>
</layout>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="icon_size_listboxrow">
<property name="child">
Expand Down Expand Up @@ -2401,6 +2441,12 @@ See the &lt;a href=&quot;https://www.gnu.org/licenses/old-licenses/gpl-2.0.html&
</object>
</child>
</object>
<object class="GtkAdjustment" id="dock_margin_size_adjustment">
<property name="lower">0</property>
<property name="upper">300</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="max_opacity_adjustement">
<property name="upper">1</property>
<property name="step-increment">0.01</property>
Expand Down
11 changes: 8 additions & 3 deletions docking.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,11 @@ const DockedDash = GObject.registerClass({
() => {
this.dash.setIconSize(settings.dashMaxIconSize);
},
], [
settings,
"changed::dock-margin-size",
this._resetPosition.bind(this)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray newline

], [
settings,
'changed::show-favorites',
Expand Down Expand Up @@ -1168,7 +1173,7 @@ const DockedDash = GObject.registerClass({
// Ensure variables linked to settings are updated.
this._updateVisibilityMode();

const {dockFixed: fixedIsEnabled, dockExtended: extendHeight} = DockManager.settings;
const {dockFixed: fixedIsEnabled, dockExtended: extendHeight, dockMarginSize: margin} = DockManager.settings;

if (fixedIsEnabled)
this.add_style_class_name('fixed');
Expand Down Expand Up @@ -1197,7 +1202,7 @@ const DockedDash = GObject.registerClass({
this.y = posY;

if (extendHeight) {
this.dash._container.set_width(this.width);
this.dash._container.set_width(this.width - margin * 2);
this.add_style_class_name('extended');
} else {
this.dash._container.set_width(-1);
Expand All @@ -1214,7 +1219,7 @@ const DockedDash = GObject.registerClass({
this.y = workArea.y + Math.round((1 - fraction) / 2 * workArea.height);

if (extendHeight) {
this.dash._container.set_height(this.height);
this.dash._container.set_height(this.height - margin * 2);
this.add_style_class_name('extended');
} else {
this.dash._container.set_height(-1);
Expand Down
39 changes: 39 additions & 0 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ const DockSettings = GObject.registerClass({
});
}

dock_margin_size_value_changed_cb(scale) {
// Get the current value of the scale
const value = scale.get_value();

// Update the GSettings key
this._settings.set_int("dock-margin-size", value);
}

icon_size_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._icon_size_timeout > 0)
Expand Down Expand Up @@ -587,18 +595,44 @@ const DockSettings = GObject.registerClass({
});
this._builder.get_object('preview_size_scale').set_value(
this._settings.get_double('preview-size-scale'));


// Dock Margin Size
const dockMarginSizeScale = this._builder.get_object(
"dock_margin_size_scale"
);
dockMarginSizeScale.set_range(0, 300); // Set the range for the margin size
dockMarginSizeScale.set_value(this._settings.get_int("dock-margin-size")); // Initialize with the current value
dockMarginSizeScale.set_format_value_func((_, value) => {
return `${value} px`; // Display the value in pixels
});

dockMarginSizeScale.connect("value-changed", (scale) => {
// Update the GSettings key when the value changes
this._settings.set_int("dock-margin-size", scale.get_value());
});

this._settings.bind(
"dock-margin-size",
dockMarginSizeScale,
"value",
Gio.SettingsBindFlags.DEFAULT
);

// Corrent for rtl languages
if (this._rtl) {
// Flip value position: this is not done automatically
dockSizeScale.set_value_pos(Gtk.PositionType.LEFT);
iconSizeScale.set_value_pos(Gtk.PositionType.LEFT);
dockMarginSizeScale.set_value_pos(Gtk.PositionType.LEFT);
// I suppose due to a bug, having a more than one mark and one above
// a value of 100 makes the rendering of the marks wrong in rtl.
// This doesn't happen setting the scale as not flippable
// and then manually inverting it
iconSizeScale.set_flippable(false);
dockMarginSizeScale.set_flippable(false);
iconSizeScale.set_inverted(true);
dockMarginSizeScale.set_inverted(true);
}

this._settings.bind('icon-size-fixed',
Expand All @@ -613,6 +647,11 @@ const DockSettings = GObject.registerClass({
this._builder.get_object('dock_size_scale'),
'sensitive',
Gio.SettingsBindFlags.INVERT_BOOLEAN);
this._settings.bind(
"extend-height",
this._builder.get_object("dock_margin_size_scale"),
"sensitive",
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('always-center-icons',
this._builder.get_object('dock_center_icons_check'),
'active',
Expand Down
5 changes: 5 additions & 0 deletions schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@
<default>false</default>
<summary>Center icons when dock container is extended to all the available size</summary>
</key>
<key name="dock-margin-size" type="i">
<default>0</default>
<summary>Dock margin size</summary>
<description>The margin size around the dock in pixels.</description>
</key>
<key type="i" name="preferred-monitor">
<default>-2</default>
<summary>DEPRECATED: Monitor on which putting the dock (by index)</summary>
Expand Down