Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial support for GNOME 40 #159

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/

Expand Down
24 changes: 14 additions & 10 deletions multi-monitors-add-on@spin83/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {

Expand All @@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -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;

Expand Down Expand Up @@ -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() {
Expand All @@ -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');
}
}
Expand All @@ -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));

Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions multi-monitors-add-on@spin83/metadata.json
Original file line number Diff line number Diff line change
@@ -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
}
27 changes: 26 additions & 1 deletion multi-monitors-add-on@spin83/mmcalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
// <https://gjs.guide/guides/gobject/subclassing.html#gtypename> 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 () {
Expand Down Expand Up @@ -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,
Expand Down
57 changes: 33 additions & 24 deletions multi-monitors-add-on@spin83/mmoverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -353,6 +354,7 @@ var MultiMonitorsThumbnailsSlider = (() => {
MultiMonitors.copyClass(OverviewControls.ThumbnailsSlider, MultiMonitorsThumbnailsSlider);
return GObject.registerClass(MultiMonitorsThumbnailsSlider);
})();
*/

var MultiMonitorsControlsManager = GObject.registerClass(
class MultiMonitorsControlsManager extends St.Widget {
Expand All @@ -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,
Expand All @@ -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);
}
Expand All @@ -413,6 +420,7 @@ class MultiMonitorsControlsManager extends St.Widget {
this._thumbnailsSelectSide();
}

/*
_thumbnailsSelectSide() {
let thumbnailsSlider;
thumbnailsSlider = this._thumbnailsSlider;
Expand Down Expand Up @@ -440,6 +448,7 @@ class MultiMonitorsControlsManager extends St.Widget {
}
this._fixGeometry = 3;
}
*/

_updateSpacerVisibility() {
if (Main.layoutManager.monitors.length<this._monitorIndex)
Expand Down Expand Up @@ -468,9 +477,9 @@ class MultiMonitorsControlsManager extends St.Widget {
getWorkspacesActualGeometry() {
let geometry;
if (this._visible) {
const [x, y] = this._viewSelector.get_transformed_position();
const width = this._viewSelector.allocation.get_width();
const height = this._viewSelector.allocation.get_height();
const [x, y] = this._searchController.get_transformed_position();
const width = this._searchController.allocation.get_width();
const height = this._searchController.allocation.get_height();
geometry = { x, y, width, height };
}
else {
Expand All @@ -496,20 +505,18 @@ class MultiMonitorsControlsManager extends St.Widget {
(Main.overview.animationInProgress && !Main.overview.visibleTarget))
return;

let activePage = Main.overview.viewSelector.getActivePage();
let thumbnailsVisible = activePage == ViewSelector.ViewPage.WINDOWS;
let activePage = Main.overview.searchController.getActivePage();
let thumbnailsVisible = activePage == SearchController.ViewPage.WINDOWS;

let opacity = null;
if (thumbnailsVisible) {
opacity = 255;
if (this._fixGeometry===1)
this._fixGeometry = 0;
this._thumbnailsSlider.slideIn();
}
else {
opacity = 0;
this._fixGeometry = 1;
this._thumbnailsSlider.slideOut();
}

if (!this._workspacesViews)
Expand All @@ -523,12 +530,12 @@ class MultiMonitorsControlsManager extends St.Widget {
}

_onPageEmpty() {
this._thumbnailsSlider.pageEmpty();
//this._thumbnailsSlider.pageEmpty();
}

show() {
this._viewSelector.visible = true;
this._workspacesViews = Main.overview.viewSelector._workspacesDisplay._workspacesViews[this._monitorIndex];
this._searchController.visible = true;
this._workspacesViews = Main.overview.searchController._workspacesDisplay._workspacesViews[this._monitorIndex];
this._visible = true;
const geometry = this.getWorkspacesActualGeometry();

Expand All @@ -537,6 +544,7 @@ class MultiMonitorsControlsManager extends St.Widget {
return;
}

/*
if (this._fixGeometry) {
const width = this._thumbnailsSlider.get_width();
if (this._fixGeometry===2) {
Expand All @@ -552,6 +560,7 @@ class MultiMonitorsControlsManager extends St.Widget {
}
this._fixGeometry = 0;
}
*/

this._workspacesViews.ease({
...geometry,
Expand All @@ -571,7 +580,7 @@ class MultiMonitorsControlsManager extends St.Widget {
duration: Main.overview.animationInProgress ? Overview.ANIMATION_TIME : 0,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
this._viewSelector.visible = false;
this._searchController.visible = false;
},
});
this._workspacesViews = null;
Expand Down
6 changes: 0 additions & 6 deletions multi-monitors-add-on@spin83/mmpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down
Loading