diff --git a/Settings.ui b/Settings.ui
index 0cf4b11..c55dfac 100644
--- a/Settings.ui
+++ b/Settings.ui
@@ -313,6 +313,50 @@
+
+
+
diff --git a/panel.js b/panel.js
index 5903cb3..2b49c14 100644
--- a/panel.js
+++ b/panel.js
@@ -46,6 +46,7 @@ const Shell = imports.gi.Shell;
const PopupMenu = imports.ui.popupMenu;
const IconGrid = imports.ui.iconGrid;
const ViewSelector = imports.ui.viewSelector;
+const DateMenu = imports.ui.dateMenu;
const Intellihide = Me.imports.intellihide;
@@ -743,16 +744,15 @@ var dtpSecondaryPanel = new Lang.Class({
Name: 'DashToPanel.SecondaryPanel',
Extends: Panel.Panel,
- _init : function(monitorIndex, panelBox) {
- this.monitorIndex = monitorIndex;
- this.panelBox = panelBox;
+ _init : function(settings, monitor) {
+ this._dtpSettings = settings;
this.actor = new Shell.GenericContainer({ name: 'panel', reactive: true });
this.actor._delegate = this;
this._sessionStyle = null;
- this.statusArea = {};
+ this.statusArea = { aggregateMenu: { container: null } };
this.menuManager = new PopupMenu.PopupMenuManager(this);
@@ -769,16 +769,48 @@ var dtpSecondaryPanel = new Lang.Class({
this._rightCorner = new Panel.PanelCorner(St.Side.RIGHT);
this.actor.add_actor(this._rightCorner.actor);
+ this._setDateMenu();
+ this.showClockOnAllMonitorsId = this._dtpSettings.connect('changed::show-clock-all-monitors', () => this._setDateMenu());
+
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
- Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar")+" "+this.monitorIndex, 'focus-top-bar-symbolic',
+ Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar")+" "+ monitor.index, 'focus-top-bar-symbolic',
{ sortGroup: CtrlAltTab.SortGroup.TOP });
},
+
+ _setDateMenu: function() {
+ if (!this._dtpSettings.get_boolean('show-clock-all-monitors')) {
+ this._removeDateMenu();
+ } else if (!this.statusArea.dateMenu) {
+ this.statusArea.dateMenu = new DateMenu.DateMenuButton();
+ this.menuManager.addMenu(this.statusArea.dateMenu.menu);
+
+ //adding the clock to the centerbox will correctly position it according to dtp settings (event in dtpPanelWrapper)
+ this._centerBox.add_actor(this.statusArea.dateMenu.container);
+ }
+ },
+ _removeDateMenu: function() {
+ if (this.statusArea.dateMenu) {
+ let parent = this.statusArea.dateMenu.container.get_parent();
+
+ if (parent) {
+ parent.remove_actor(this.statusArea.dateMenu.container);
+ }
+
+ //this.statusArea.dateMenu.destroy(); //buggy for now, creates the same error as when destroying the default gnome-shell clock
+ this.menuManager.removeMenu(this.statusArea.dateMenu.menu);
+ this.statusArea.dateMenu = null;
+ }
+ },
+
_onDestroy: function(actor) {
Main.ctrlAltTabManager.removeGroup(this.actor);
-
+
+ this._dtpSettings.disconnect(this.showClockOnAllMonitorsId);
+ this._removeDateMenu();
+
this.actor._delegate = null;
},
diff --git a/panelManager.js b/panelManager.js
index 99e9b70..91f5bb3 100644
--- a/panelManager.js
+++ b/panelManager.js
@@ -62,14 +62,14 @@ var dtpPanelManager = new Lang.Class({
if (this._dtpSettings.get_boolean('multi-monitors')) {
Main.layoutManager.monitors.forEach(monitor => {
- if(monitor == dtpPrimaryMonitor)
+ if (monitor == dtpPrimaryMonitor)
return;
let panelBox = new St.BoxLayout({ name: 'dashtopanelSecondaryPanelBox', vertical: true });
Main.layoutManager.addChrome(panelBox, { affectsStruts: true, trackFullscreen: true });
Main.uiGroup.set_child_below_sibling(panelBox, Main.layoutManager.panelBox);
- let panel = new Panel.dtpSecondaryPanel();
+ let panel = new Panel.dtpSecondaryPanel(this._dtpSettings, monitor);
panelBox.add(panel.actor);
panelBox.set_position(monitor.x, monitor.y);
diff --git a/prefs.js b/prefs.js
index 266cb0f..1ddc204 100644
--- a/prefs.js
+++ b/prefs.js
@@ -438,6 +438,11 @@ const Settings = new Lang.Class({
this._settings.bind('isolate-monitors',
this._builder.get_object('multimon_multi_isolate_monitor_switch'),
'active',
+ Gio.SettingsBindFlags.DEFAULT);
+
+ this._settings.bind('show-clock-all-monitors',
+ this._builder.get_object('multimon_multi_show_clock_switch'),
+ 'active',
Gio.SettingsBindFlags.DEFAULT);
this._builder.get_object('multimon_multi_options_button').connect('clicked', Lang.bind(this, function() {
@@ -457,6 +462,7 @@ const Settings = new Lang.Class({
if (id == 1) {
// restore default settings
this._settings.set_value('isolate-monitors', this._settings.get_default_value('isolate-monitors'));
+ this._settings.set_value('show-clock-all-monitors', this._settings.get_default_value('show-clock-all-monitors'));
} else {
// remove the settings box so it doesn't get destroyed;
dialog.get_content_area().remove(box);
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 be3a9b7..8d7ead0 100644
--- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
@@ -349,6 +349,11 @@
Provide monitor isolation
Dash shows only windows from the current monitor
+
+ true
+ Display the clock on all monitors
+ Specifies if every panel should display the clock. If false, the clock is only displayed on the primary monitor.
+
true
Customize click behaviour