🔧 Add shell version check
This commit is contained in:
+1
-4
@@ -15,9 +15,6 @@
|
|||||||
|
|
||||||
const {Clutter, Gio, Meta} = imports.gi;
|
const {Clutter, Gio, Meta} = imports.gi;
|
||||||
|
|
||||||
const Config = imports.misc.config;
|
|
||||||
const [GS_MAJOR, GS_MINOR] = Config.PACKAGE_VERSION.split('.');
|
|
||||||
|
|
||||||
const Workspace = imports.ui.workspace.Workspace;
|
const Workspace = imports.ui.workspace.Workspace;
|
||||||
const WindowManager = imports.ui.windowManager.WindowManager;
|
const WindowManager = imports.ui.windowManager.WindowManager;
|
||||||
const WINDOW_REPOSITIONING_DELAY = imports.ui.workspace.WINDOW_REPOSITIONING_DELAY;
|
const WINDOW_REPOSITIONING_DELAY = imports.ui.workspace.WINDOW_REPOSITIONING_DELAY;
|
||||||
@@ -89,7 +86,7 @@ class Extension {
|
|||||||
// overview window layout. Therefore we call this method in addition.
|
// overview window layout. Therefore we call this method in addition.
|
||||||
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/gnome-3-36/js/ui/workspace.js#L1877
|
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/gnome-3-36/js/ui/workspace.js#L1877
|
||||||
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/workspace.js#L1415
|
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/workspace.js#L1415
|
||||||
if (GS_MAJOR == 3 && GS_MINOR == 36) {
|
if (utils.shellVersionIs(3, 36)) {
|
||||||
Workspace.prototype._addWindowClone = function(...params) {
|
Workspace.prototype._addWindowClone = function(...params) {
|
||||||
const [clone, overlay] = extensionThis._origAddWindowClone.apply(this, params);
|
const [clone, overlay] = extensionThis._origAddWindowClone.apply(this, params);
|
||||||
clone.connect('destroy', () => this._doRemoveWindow(clone.metaWindow));
|
clone.connect('destroy', () => this._doRemoveWindow(clone.metaWindow));
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
|
|
||||||
const {Gtk} = imports.gi;
|
const {Gtk} = imports.gi;
|
||||||
|
|
||||||
|
const Config = imports.misc.config;
|
||||||
|
const [GS_MAJOR, GS_MINOR] = Config.PACKAGE_VERSION.split('.');
|
||||||
|
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
@@ -42,3 +45,19 @@ function debug(message) {
|
|||||||
function isGTK4() {
|
function isGTK4() {
|
||||||
return Gtk.get_major_version() == 4;
|
return Gtk.get_major_version() == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shellVersionIs(major, minor) {
|
||||||
|
return GS_MAJOR == major && GS_MINOR == minor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function shellVersionIsAtLeast(major, minor) {
|
||||||
|
if (GS_MAJOR > major) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GS_MAJOR == major) {
|
||||||
|
return GS_MINOR >= minor;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -62,10 +62,6 @@ var FirePage = class FirePage extends PrefsPage {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------- public methods
|
// ---------------------------------------------------------------------- public methods
|
||||||
|
|
||||||
getMinVersion() {
|
|
||||||
return [3, 36];
|
|
||||||
}
|
|
||||||
|
|
||||||
getEnabledKey() {
|
getEnabledKey() {
|
||||||
return 'fire-close-effect';
|
return 'fire-close-effect';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||||
|
const utils = Me.imports.src.common.utils;
|
||||||
const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage;
|
const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -27,6 +28,10 @@ var MatrixPage = class MatrixPage extends PrefsPage {
|
|||||||
constructor(settings, builder) {
|
constructor(settings, builder) {
|
||||||
super(settings, builder);
|
super(settings, builder);
|
||||||
|
|
||||||
|
if (!utils.shellVersionIsAtLeast(40, 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._builder.add_from_resource('/ui/gtk4/matrixPage.ui');
|
this._builder.add_from_resource('/ui/gtk4/matrixPage.ui');
|
||||||
|
|
||||||
// Bind all properties.
|
// Bind all properties.
|
||||||
@@ -42,10 +47,6 @@ var MatrixPage = class MatrixPage extends PrefsPage {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------- public methods
|
// ---------------------------------------------------------------------- public methods
|
||||||
|
|
||||||
getMinVersion() {
|
|
||||||
return [40, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
getEnabledKey() {
|
getEnabledKey() {
|
||||||
return 'matrix-close-effect';
|
return 'matrix-close-effect';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||||
|
const utils = Me.imports.src.common.utils;
|
||||||
const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage;
|
const PrefsPage = Me.imports.src.prefs.PrefsPage.PrefsPage;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -27,6 +28,10 @@ var TRexPage = class TRexPage extends PrefsPage {
|
|||||||
constructor(settings, builder) {
|
constructor(settings, builder) {
|
||||||
super(settings, builder);
|
super(settings, builder);
|
||||||
|
|
||||||
|
if (!utils.shellVersionIsAtLeast(40, 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._builder.add_from_resource('/ui/gtk4/trexPage.ui');
|
this._builder.add_from_resource('/ui/gtk4/trexPage.ui');
|
||||||
|
|
||||||
// Bind all properties.
|
// Bind all properties.
|
||||||
@@ -42,10 +47,6 @@ var TRexPage = class TRexPage extends PrefsPage {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------- public methods
|
// ---------------------------------------------------------------------- public methods
|
||||||
|
|
||||||
getMinVersion() {
|
|
||||||
return [40, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
getEnabledKey() {
|
getEnabledKey() {
|
||||||
return 'trex-close-effect';
|
return 'trex-close-effect';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ var TVEffectPage = class TVEffectPage extends PrefsPage {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------- public methods
|
// ---------------------------------------------------------------------- public methods
|
||||||
|
|
||||||
getMinVersion() {
|
|
||||||
return [3, 36];
|
|
||||||
}
|
|
||||||
|
|
||||||
getEnabledKey() {
|
getEnabledKey() {
|
||||||
return 'tv-close-effect';
|
return 'tv-close-effect';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user