diff --git a/README.md b/README.md index afca60d..4aaa45a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ in dynamic fashion, no restart needed. Versions ======== -* Branch [master](https://github.com/spin83/multi-monitors-add-on/tree/master) contains extension for GNOME 3.38 +* Branch [master](https://github.com/realh/multi-monitors-add-on/tree/master) contains extension for GNOME 42 * Branch [gnome-3-32_3-36](https://github.com/spin83/multi-monitors-add-on/tree/gnome-3-32_3-36) contains extension for GNOME 3.32, 3.34 and 3.36 * Branch [gnome-3-24_3-30](https://github.com/spin83/multi-monitors-add-on/tree/gnome-3-24_3-30) contains extension for GNOME 3.24, 3.26, 3.28 and 3.30 * Branch [gnome-3-20_3-22](https://github.com/spin83/multi-monitors-add-on/tree/gnome-3-20_3-22) contains extension for GNOME 3.20 and 3.22 @@ -20,7 +20,7 @@ Versions Installation from git ===================== - git clone git://github.com/spin83/multi-monitors-add-on.git + git clone git://github.com/realh/multi-monitors-add-on.git cd multi-monitors-add-on cp -r multi-monitors-add-on@spin83 ~/.local/share/gnome-shell/extensions/ diff --git a/multi-monitors-add-on@spin83/extension.js b/multi-monitors-add-on@spin83/extension.js index e1928e9..0a3dce7 100644 --- a/multi-monitors-add-on@spin83/extension.js +++ b/multi-monitors-add-on@spin83/extension.js @@ -40,6 +40,7 @@ const THUMBNAILS_SLIDER_POSITION_ID = 'thumbnails-slider-position'; function copyClass (s, d) { // global.log(s.name +" > "+ d.name); + if (!s) throw Error(`copyClass s undefined for d ${d.name}`) let propertyNames = Reflect.ownKeys(s.prototype); for (let pName of propertyNames.values()) { @@ -64,7 +65,7 @@ class MultiMonitorsAddOn { constructor() { this._settings = Convenience.getSettings(); - this._ov_settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA }); +// this._ov_settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA }); this._mu_settings = new Gio.Settings({ schema: MUTTER_SCHEMA }); this.mmIndicator = null; @@ -99,8 +100,8 @@ class MultiMonitorsAddOn { return; } - if(this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID)) - this._ov_settings.set_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID, false); +// if(this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID)) +// this._ov_settings.set_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID, false); if(this._mu_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID)) this._mu_settings.set_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID, false); @@ -114,8 +115,8 @@ class MultiMonitorsAddOn { } } - this.syncWorkspacesActualGeometry = Main.overview.viewSelector._workspacesDisplay._syncWorkspacesActualGeometry; - Main.overview.viewSelector._workspacesDisplay._syncWorkspacesActualGeometry = function() { + this.syncWorkspacesActualGeometry = Main.overview.searchController._workspacesDisplay._syncWorkspacesActualGeometry; + Main.overview.searchController._workspacesDisplay._syncWorkspacesActualGeometry = function() { if (this._inWindowFade) return; @@ -156,7 +157,7 @@ class MultiMonitorsAddOn { Main.mmOverview[idx].destroy(); } Main.mmOverview = null; - Main.overview.viewSelector._workspacesDisplay._syncWorkspacesActualGeometry = this.syncWorkspacesActualGeometry; + Main.overview.searchController._workspacesDisplay._syncWorkspacesActualGeometry = this.syncWorkspacesActualGeometry; } _relayout() { @@ -173,7 +174,10 @@ class MultiMonitorsAddOn { } _switchOffThumbnails() { - if (this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID) || this._mu_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID)) { + if ( +// this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID) || + this._mu_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID)) + { this._settings.set_string(THUMBNAILS_SLIDER_POSITION_ID, 'none'); } } @@ -186,8 +190,8 @@ class MultiMonitorsAddOn { this._mmMonitors = 0; - this._switchOffThumbnailsOvId = this._ov_settings.connect('changed::'+WORKSPACES_ONLY_ON_PRIMARY_ID, - this._switchOffThumbnails.bind(this)); +// this._switchOffThumbnailsOvId = this._ov_settings.connect('changed::'+WORKSPACES_ONLY_ON_PRIMARY_ID, +// this._switchOffThumbnails.bind(this)); this._switchOffThumbnailsMuId = this._mu_settings.connect('changed::'+WORKSPACES_ONLY_ON_PRIMARY_ID, this._switchOffThumbnails.bind(this)); @@ -205,7 +209,7 @@ class MultiMonitorsAddOn { disable() { Main.layoutManager.disconnect(this._relayoutId); - this._ov_settings.disconnect(this._switchOffThumbnailsOvId); +// this._ov_settings.disconnect(this._switchOffThumbnailsOvId); this._mu_settings.disconnect(this._switchOffThumbnailsMuId); this._settings.disconnect(this._showPanelId); diff --git a/multi-monitors-add-on@spin83/metadata.json b/multi-monitors-add-on@spin83/metadata.json index d285459..35ea54b 100644 --- a/multi-monitors-add-on@spin83/metadata.json +++ b/multi-monitors-add-on@spin83/metadata.json @@ -1,10 +1,10 @@ { - "shell-version": ["3.38"], + "shell-version": ["40", "41", "42", "43", "44"], "uuid": "multi-monitors-add-on@spin83", "name": "Multi Monitors Add-On", "settings-schema": "org.gnome.shell.extensions.multi-monitors-add-on", "gettext-domain": "multi-monitors-add-on", "description": "Add multiple monitors overview and panel for gnome-shell.", "url": "https://github.com/spin83/multi-monitors-add-on.git", - "version": 23 + "version": 26 } diff --git a/multi-monitors-add-on@spin83/mmcalendar.js b/multi-monitors-add-on@spin83/mmcalendar.js index 8e3521b..66237f4 100644 --- a/multi-monitors-add-on@spin83/mmcalendar.js +++ b/multi-monitors-add-on@spin83/mmcalendar.js @@ -24,12 +24,37 @@ const PanelMenu = imports.ui.panelMenu; const MessageList = imports.ui.messageList; const DateMenu = imports.ui.dateMenu; const Calendar = imports.ui.calendar; +const PopupMenu = imports.ui.popupMenu; const ExtensionUtils = imports.misc.extensionUtils; const CE = ExtensionUtils.getCurrentExtension(); const MultiMonitors = CE.imports.extension; const Convenience = CE.imports.convenience; +// Calendar.DoNotDisturbSwitch is const, so not exported. Either +// is untrue, or +// GObject.type_from_name() is broken, so we can't get its constructor via GI +// either. Luckily it's a short class, so we can copy & paste. +const MultiMonitorsDoNotDisturbSwitch = GObject.registerClass( +class MultiMonitorsDoNotDisturbSwitch extends PopupMenu.Switch { + _init() { + this._settings = new Gio.Settings({ + schema_id: 'org.gnome.desktop.notifications', + }); + + super._init(this._settings.get_boolean('show-banners')); + + this._settings.bind('show-banners', + this, 'state', + Gio.SettingsBindFlags.INVERT_BOOLEAN); + + this.connect('destroy', () => { + this._settings.run_dispose(); + this._settings = null; + }); + } +}); + var MultiMonitorsCalendar = (() => { let MultiMonitorsCalendar = class MultiMonitorsCalendar extends St.Widget { _init () { @@ -180,7 +205,7 @@ var MultiMonitorsCalendarMessageList = (() => { }); hbox.add_child(dndLabel); - this._dndSwitch = new Calendar.DoNotDisturbSwitch(); + this._dndSwitch = new MultiMonitorsDoNotDisturbSwitch(); this._dndButton = new St.Button({ can_focus: true, toggle_mode: true, diff --git a/multi-monitors-add-on@spin83/mmoverview.js b/multi-monitors-add-on@spin83/mmoverview.js index b688452..b7555d2 100644 --- a/multi-monitors-add-on@spin83/mmoverview.js +++ b/multi-monitors-add-on@spin83/mmoverview.js @@ -22,7 +22,7 @@ const Params = imports.misc.params; const WorkspaceThumbnail = imports.ui.workspaceThumbnail; const OverviewControls = imports.ui.overviewControls; const Overview = imports.ui.overview; -const ViewSelector = imports.ui.viewSelector; +const SearchController = imports.ui.searchController; const LayoutManager = imports.ui.layout; const Background = imports.ui.background; const WorkspacesView = imports.ui.workspacesView; @@ -278,6 +278,7 @@ const MultiMonitorsThumbnailsBox = (() => { }, MultiMonitorsThumbnailsBox); })(); +/* This isn't compatible with GNOME 40 and i don't know how to fix it -- TH var MultiMonitorsSlidingControl = (() => { let MultiMonitorsSlidingControl = class MultiMonitorsSlidingControl extends St.Widget { _init(params) { @@ -353,6 +354,7 @@ var MultiMonitorsThumbnailsSlider = (() => { MultiMonitors.copyClass(OverviewControls.ThumbnailsSlider, MultiMonitorsThumbnailsSlider); return GObject.registerClass(MultiMonitorsThumbnailsSlider); })(); +*/ var MultiMonitorsControlsManager = GObject.registerClass( class MultiMonitorsControlsManager extends St.Widget { @@ -363,7 +365,12 @@ class MultiMonitorsControlsManager extends St.Widget { this._fixGeometry = 0; this._visible = false; - let layout = new OverviewControls.ControlsLayout(); + let layout + if (OverviewControls.ControlsManagerLayout) { + layout = new OverviewControls.ControlsManagerLayout(); + } else { + layout = new OverviewControls.ControlsLayout(); + } super._init({ layout_manager: layout, x_expand: true, @@ -375,35 +382,35 @@ class MultiMonitorsControlsManager extends St.Widget { this._thumbnailsBox = new MultiMonitorsThumbnailsBox(this._workspaceAdjustment, this._monitorIndex); - this._thumbnailsSlider = new MultiMonitorsThumbnailsSlider(this._thumbnailsBox); + //this._thumbnailsSlider = new MultiMonitorsThumbnailsSlider(this._thumbnailsBox); - this._viewSelector = new St.Widget({ visible: false, x_expand: true, y_expand: true, clip_to_allocation: true }); - this._pageChangedId = Main.overview.viewSelector.connect('page-changed', this._setVisibility.bind(this)); - this._pageEmptyId = Main.overview.viewSelector.connect('page-empty', this._onPageEmpty.bind(this)); + this._searchController = new St.Widget({ visible: false, x_expand: true, y_expand: true, clip_to_allocation: true }); + this._pageChangedId = Main.overview.searchController.connect('page-changed', this._setVisibility.bind(this)); + this._pageEmptyId = Main.overview.searchController.connect('page-empty', this._onPageEmpty.bind(this)); this._group = new St.BoxLayout({ name: 'mm-overview-group-'+index, x_expand: true, y_expand: true }); this.add_actor(this._group); - this._group.add_child(this._viewSelector); - this._group.add_actor(this._thumbnailsSlider); + this._group.add_child(this._searchController); + //this._group.add_actor(this._thumbnailsSlider); this._settings = Convenience.getSettings(); this._monitorsChanged(); - this._thumbnailsSlider.slideOut(); + //this._thumbnailsSlider.slideOut(); this._thumbnailsBox._updatePorthole(); this.connect('notify::allocation', this._updateSpacerVisibility.bind(this)); this.connect('destroy', this._onDestroy.bind(this)); - this._thumbnailsSelectSideId = this._settings.connect('changed::'+THUMBNAILS_SLIDER_POSITION_ID, - this._thumbnailsSelectSide.bind(this)); + //this._thumbnailsSelectSideId = this._settings.connect('changed::'+THUMBNAILS_SLIDER_POSITION_ID, + // this._thumbnailsSelectSide.bind(this)); this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', this._monitorsChanged.bind(this)); } _onDestroy() { - Main.overview.viewSelector.disconnect(this._pageChangedId); - Main.overview.viewSelector.disconnect(this._pageEmptyId); + Main.overview.searchController.disconnect(this._pageChangedId); + Main.overview.searchController.disconnect(this._pageEmptyId); this._settings.disconnect(this._thumbnailsSelectSideId); Main.layoutManager.disconnect(this._monitorsChangedId); } @@ -413,6 +420,7 @@ class MultiMonitorsControlsManager extends St.Widget { this._thumbnailsSelectSide(); } + /* _thumbnailsSelectSide() { let thumbnailsSlider; thumbnailsSlider = this._thumbnailsSlider; @@ -440,6 +448,7 @@ class MultiMonitorsControlsManager extends St.Widget { } this._fixGeometry = 3; } + */ _updateSpacerVisibility() { if (Main.layoutManager.monitors.length { - this._viewSelector.visible = false; + this._searchController.visible = false; }, }); this._workspacesViews = null; diff --git a/multi-monitors-add-on@spin83/mmpanel.js b/multi-monitors-add-on@spin83/mmpanel.js index bf46617..a381f15 100644 --- a/multi-monitors-add-on@spin83/mmpanel.js +++ b/multi-monitors-add-on@spin83/mmpanel.js @@ -376,12 +376,6 @@ var MultiMonitorsPanel = (() => { this._rightBox = new St.BoxLayout({ name: 'panelRight' }); this.add_child(this._rightBox); - this._leftCorner = new Panel.PanelCorner(St.Side.LEFT); - this.add_child(this._leftCorner); - - this._rightCorner = new Panel.PanelCorner(St.Side.RIGHT); - this.add_child(this._rightCorner); - this._showingId = Main.overview.connect('showing', () => { this.add_style_pseudo_class('overview'); }); diff --git a/multi-monitors-add-on@spin83/prefs.js b/multi-monitors-add-on@spin83/prefs.js index a8d1b58..d1ba7ea 100644 --- a/multi-monitors-add-on@spin83/prefs.js +++ b/multi-monitors-add-on@spin83/prefs.js @@ -50,15 +50,18 @@ var MultiMonitorsPrefsWidget = GObject.registerClass( class MultiMonitorsPrefsWidget extends Gtk.Grid { _init() { super._init({ - margin: 6, + margin_top: 6, margin_end: 6, margin_bottom: 6, margin_start: 6 }); + this._numRows = 0; + this.set_orientation(Gtk.Orientation.VERTICAL); this._settings = Convenience.getSettings(); this._desktopSettings = Convenience.getSettings("org.gnome.desktop.interface"); - this._screen = Gdk.Screen.get_default(); + this._display = Gdk.Display.get_default(); + this._monitors = this._display.get_monitors() this._addBooleanSwitch(_('Show Multi Monitors indicator on Top Panel.'), SHOW_INDICATOR_ID); this._addBooleanSwitch(_('Show Panel on additional monitors.'), SHOW_PANEL_ID); @@ -93,23 +96,27 @@ class MultiMonitorsPrefsWidget extends Gtk.Grid { this._treeView.append_column(appColumn); this.add(this._treeView); - let toolbar = new Gtk.Toolbar(); - toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR); + let toolbar = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL}); + toolbar.get_style_context().add_class("inline-toolbar"); this._settings.connect('changed::'+TRANSFER_INDICATORS_ID, Lang.bind(this, this._updateIndicators)); this._updateIndicators(); - let addTButton = new Gtk.ToolButton({ stock_id: Gtk.STOCK_ADD }); + let addTButton = new Gtk.Button({ icon_name: "list-add" }); addTButton.connect('clicked', Lang.bind(this, this._addIndicator)); - toolbar.add(addTButton); + toolbar.append(addTButton); - let removeTButton = new Gtk.ToolButton({ stock_id: Gtk.STOCK_REMOVE }); + let removeTButton = new Gtk.Button({ icon_name: "list-remove" }); removeTButton.connect('clicked', Lang.bind(this, this._removeIndicator)); - toolbar.add(removeTButton); + toolbar.append(removeTButton); this.add(toolbar); } + add(child) { + this.attach(child, 0, this._numRows++, 1, 1); + } + _updateIndicators() { this._store.clear(); @@ -132,7 +139,8 @@ class MultiMonitorsPrefsWidget extends Gtk.Grid { dialog.add_button(_("Add"), Gtk.ResponseType.OK); dialog.set_default_response(Gtk.ResponseType.OK); - let grid = new Gtk.Grid({ column_spacing: 10, row_spacing: 15, margin: 10 }); + let grid = new Gtk.Grid({ column_spacing: 10, row_spacing: 15, + margin_top: 10, margin_end: 10, margin_bottom: 10, margin_start: 10 }); grid.set_orientation(Gtk.Orientation.VERTICAL); @@ -168,31 +176,32 @@ class MultiMonitorsPrefsWidget extends Gtk.Grid { availableIndicators); availableIndicators.apply(this); -// grid.attach(dialog._treeView, 0, 0, 2, 1); - grid.add(dialog._treeView); + grid.attach(dialog._treeView, 0, 0, 2, 1); - let gHBox = new Gtk.HBox({margin: 10, spacing: 20, hexpand: true}); + let gHBox = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL, + margin_top: 10, margin_end: 10, margin_bottom: 10, margin_start: 10, + spacing: 20, hexpand: true}); let gLabel = new Gtk.Label({label: _('Monitor index:'), halign: Gtk.Align.START}); - gHBox.add(gLabel); + gHBox.append(gLabel); dialog._adjustment = new Gtk.Adjustment({lower: 0.0, upper: 0.0, step_increment:1.0}); let spinButton = new Gtk.SpinButton({halign: Gtk.Align.END, adjustment: dialog._adjustment, numeric: 1}); - gHBox.add(spinButton); + gHBox.append(spinButton); let monitorsChanged = () => { - let n_monitors = this._screen.get_n_monitors() -1; + let n_monitors = this._monitors.get_n_items() -1; dialog._adjustment.set_upper(n_monitors) dialog._adjustment.set_value(n_monitors); }; - let monitorsChangedId = this._screen.connect('monitors-changed', monitorsChanged); + let monitorsChangedId = this._monitors.connect('items-changed', monitorsChanged); monitorsChanged.apply(this); - grid.add(gHBox); + grid.append(gHBox); - dialog.get_content_area().add(grid); + dialog.get_content_area().append(grid); dialog.connect('response', (dialog, id) => { - this._screen.disconnect(monitorsChangedId); + this._monitors.disconnect(monitorsChangedId); this._settings.disconnect(availableIndicatorsId); this._settings.disconnect(transferIndicatorsId); if (id != Gtk.ResponseType.OK) { @@ -213,8 +222,6 @@ class MultiMonitorsPrefsWidget extends Gtk.Grid { dialog.destroy(); }); - - dialog.show_all(); } _removeIndicator() { @@ -235,16 +242,18 @@ class MultiMonitorsPrefsWidget extends Gtk.Grid { } _addSettingsComboBoxSwitch(label, settings, schema_id, options) { - let gHBox = new Gtk.HBox({margin: 10, spacing: 20, hexpand: true}); + let gHBox = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL, + margin_top: 10, margin_end: 10, margin_bottom: 10, margin_start: 10, + spacing: 20, hexpand: true}); let gLabel = new Gtk.Label({label: _(label), halign: Gtk.Align.START}); - gHBox.add(gLabel); + gHBox.append(gLabel); let gCBox = new Gtk.ComboBoxText({halign: Gtk.Align.END}); Object.entries(options).forEach(function(entry) { const [key, val] = entry; gCBox.append(key, val); }); - gHBox.add(gCBox); + gHBox.append(gCBox); this.add(gHBox); @@ -256,11 +265,13 @@ class MultiMonitorsPrefsWidget extends Gtk.Grid { } _addSettingsBooleanSwitch(label, settings, schema_id) { - let gHBox = new Gtk.HBox({margin: 10, spacing: 20, hexpand: true}); + let gHBox = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL, + margin_top: 10, margin_end: 10, margin_bottom: 10, margin_start: 10, + spacing: 20, hexpand: true}); let gLabel = new Gtk.Label({label: _(label), halign: Gtk.Align.START}); - gHBox.add(gLabel); + gHBox.append(gLabel); let gSwitch = new Gtk.Switch({halign: Gtk.Align.END}); - gHBox.add(gSwitch); + gHBox.append(gSwitch); this.add(gHBox); settings.bind(schema_id, gSwitch, 'active', Gio.SettingsBindFlags.DEFAULT); @@ -273,7 +284,6 @@ function init() { function buildPrefsWidget() { let widget = new MultiMonitorsPrefsWidget(); - widget.show_all(); return widget; }