Add setting to sync positions on every monitor

This commit is contained in:
Charles Gagnon
2020-05-17 09:42:07 -04:00
parent a909283aa6
commit f907ccca4a
5 changed files with 62 additions and 25 deletions

View File

@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.2 -->
<!-- Generated with glade 3.36.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkAdjustment" id="appicon_margin_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="lower">0.33</property>
<property name="upper">1</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.10000000000000001</property>
<property name="page_increment">0.1</property>
</object>
<object class="GtkAdjustment" id="appicon_padding_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="lower">0.33</property>
<property name="upper">1</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.10000000000000001</property>
<property name="page_increment">0.1</property>
</object>
<object class="GtkBox" id="box_advanced_options">
<property name="visible">True</property>
@@ -1993,22 +1993,22 @@
<property name="page_increment">100</property>
</object>
<object class="GtkAdjustment" id="leftbox_padding_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="lower">0.33</property>
<property name="upper">1</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.10000000000000001</property>
<property name="page_increment">0.1</property>
</object>
<object class="GtkAdjustment" id="leftbox_size_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="lower">0.33</property>
<property name="upper">1</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.10000000000000001</property>
<property name="page_increment">0.1</property>
</object>
<object class="GtkAdjustment" id="panel_size_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="lower">0.33</property>
<property name="upper">1</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.10000000000000001</property>
<property name="page_increment">0.1</property>
</object>
<object class="GtkAdjustment" id="peek_mode_opacity_adjustment">
<property name="upper">255</property>
@@ -4026,10 +4026,10 @@
</child>
</object>
<object class="GtkAdjustment" id="statusicon_padding_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="lower">0.33</property>
<property name="upper">1</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.10000000000000001</property>
<property name="page_increment">0.1</property>
</object>
<object class="GtkAdjustment" id="trans_anim_time_adjustment">
<property name="upper">2000</property>
@@ -4265,16 +4265,16 @@
</child>
</object>
<object class="GtkAdjustment" id="tray_padding_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="lower">0.33</property>
<property name="upper">1</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.10000000000000001</property>
<property name="page_increment">0.1</property>
</object>
<object class="GtkAdjustment" id="tray_size_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="lower">0.33</property>
<property name="upper">1</property>
<property name="step_increment">0.01</property>
<property name="page_increment">0.10000000000000001</property>
<property name="page_increment">0.1</property>
</object>
<object class="GtkNotebook" id="settings_notebook">
<property name="visible">True</property>
@@ -4478,6 +4478,23 @@
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="taskbar_position_sync_button">
<property name="label" translatable="yes">Apply position changes to all monitors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_start">12</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>

View File

@@ -528,7 +528,9 @@ var dtpPanel = Utils.defineClass({
},
updateElementPositions: function() {
this._updateGroupedElements();
let panelPositions = this.panelManager.panelsElementPositions[this.monitor.index] || Pos.defaults;
this._updateGroupedElements(panelPositions);
this._disablePanelCornerSignals();
@@ -554,8 +556,7 @@ var dtpPanel = Utils.defineClass({
this.panel.actor.show();
},
_updateGroupedElements: function() {
let panelPositions = this.panelManager.panelsElementPositions[this.monitor.index] || Pos.defaults;
_updateGroupedElements: function(panelPositions) {
let previousPosition = 0;
let currentGroup = -1;
@@ -1004,8 +1005,8 @@ var dtpPanel = Utils.defineClass({
childBoxLeftCorner[fixedCoord.c1] = panelAllocFixedSize;
childBoxLeftCorner[fixedCoord.c2] = panelAllocFixedSize + this.cornerSize;
childBoxRightCorner[varCoord.c1] = panelAllocVarSize - this.cornerSize;
childBoxRightCorner[varCoord.c2] = panelAllocVarSize;
childBoxRightCorner[varCoord.c1] = box[varCoord.c2] - this.cornerSize;
childBoxRightCorner[varCoord.c2] = box[varCoord.c2];
childBoxRightCorner[fixedCoord.c1] = panelAllocFixedSize;
childBoxRightCorner[fixedCoord.c2] = panelAllocFixedSize + this.cornerSize;

View File

@@ -220,6 +220,8 @@ const Settings = new Lang.Class({
let panelInfo = positionSettings[monitorIndex] || Pos.defaults;
let updateSettings = () => {
let newPanelInfo = [];
let monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync');
let monitors = monitorSync ? this.monitors : [monitorIndex];
taskbarListBox.get_children().forEach(c => {
newPanelInfo.push({
@@ -229,7 +231,7 @@ const Settings = new Lang.Class({
});
});
positionSettings[monitorIndex] = newPanelInfo;
monitors.forEach(m => positionSettings[m] = newPanelInfo);
this._settings.set_string('panel-element-positions', JSON.stringify(positionSettings));
};
@@ -263,8 +265,8 @@ const Settings = new Lang.Class({
}
};
positionCombo.append(Pos.STACKED_TL, isVertical ? _('Stacked top') : _('Stacked left'));
positionCombo.append(Pos.STACKED_BR, isVertical ? _('Stacked bottom') :_('Stacked right'));
positionCombo.append(Pos.STACKED_TL, isVertical ? _('Stacked to top') : _('Stacked to left'));
positionCombo.append(Pos.STACKED_BR, isVertical ? _('Stacked to bottom') :_('Stacked to right'));
positionCombo.append(Pos.CENTERED, _('Centered'));
positionCombo.append(Pos.CENTERED_MONITOR, _('Monitor Center'));
positionCombo.set_active_id(el.position);
@@ -705,6 +707,16 @@ const Settings = new Lang.Class({
this._builder.get_object('multimon_primary_combo').set_active(dtpPrimaryMonitorIndex);
this._builder.get_object('taskbar_position_monitor_combo').set_active(dtpPrimaryMonitorIndex);
this._settings.bind('panel-element-positions-monitors-sync',
this._builder.get_object('taskbar_position_sync_button'),
'active',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('panel-element-positions-monitors-sync',
this._builder.get_object('taskbar_position_monitor_combo'),
'sensitive',
Gio.SettingsBindFlags.INVERT_BOOLEAN);
this._builder.get_object('multimon_primary_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_int('primary-monitor', this.monitors[widget.get_active()]);
}));

View File

@@ -72,6 +72,11 @@
<summary>Panel position</summary>
<description>Panel is shown on the Bottom or Top of the screen.</description>
</key>
<key name="panel-element-positions-monitors-sync" type="b">
<default>true</default>
<summary>Sync element positions</summary>
<description>Sync panel element positions on all monitors.</description>
</key>
<key name="panel-element-positions" type="s">
<default>'{}'</default>
<summary>Panel element positions</summary>

View File

@@ -28,6 +28,7 @@
#dashtopanelScrollview .app-well-app .overview-icon,
.dashtopanelMainPanel .show-apps .overview-icon {
background: none;
border: none;
margin: 0;
padding: 0;
@@ -43,6 +44,7 @@
background: none;
}
.dashtopanelMainPanel .show-apps:hover .overview-icon,
#dashtopanelScrollview .app-well-app:hover .dtp-container,
#dashtopanelScrollview .app-well-app:focus .dtp-container {
background-color: rgba(238, 238, 236, 0.1);