mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-15 00:34:05 +09:00
Add a setting to show the clock on all monitors
This commit is contained in:
44
Settings.ui
44
Settings.ui
@@ -313,6 +313,50 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listboxrow_multimon_multi_show_clock">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid_multimon_multi_show_clock">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">12</property>
|
||||
<property name="margin_right">12</property>
|
||||
<property name="margin_top">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="row_spacing">12</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="multimon_multi_show_clock_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Display the clock on all monitors</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="multimon_multi_show_clock_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
44
panel.js
44
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;
|
||||
},
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
6
prefs.js
6
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);
|
||||
|
||||
@@ -349,6 +349,11 @@
|
||||
<summary>Provide monitor isolation</summary>
|
||||
<description>Dash shows only windows from the current monitor</description>
|
||||
</key>
|
||||
<key type="b" name="show-clock-all-monitors">
|
||||
<default>true</default>
|
||||
<summary>Display the clock on all monitors</summary>
|
||||
<description>Specifies if every panel should display the clock. If false, the clock is only displayed on the primary monitor.</description>
|
||||
</key>
|
||||
<key type="b" name="customize-click">
|
||||
<default>true</default>
|
||||
<summary>Customize click behaviour</summary>
|
||||
|
||||
Reference in New Issue
Block a user