Skip to content

Commit 1e01d99

Browse files
committed
Add Gnome 47 support
1 parent 8fbdbed commit 1e01d99

File tree

5 files changed

+67
-24
lines changed

5 files changed

+67
-24
lines changed

extension/extensionmenu.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import GLib from 'gi://GLib';
4040
import Meta from 'gi://Meta';
4141
import Shell from 'gi://Shell';
4242
import Mtk from 'gi://Mtk';
43+
import Cogl from 'gi://Cogl';
44+
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
4345
import * as Slider from 'resource:///org/gnome/shell/ui/slider.js';
4446
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
4547
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
@@ -53,6 +55,8 @@ import * as AreaSelector from './areaselector.js';
5355
import * as Queue from './queue.js';
5456
import * as Utils from './utils.js';
5557

58+
const ShellVersion = parseFloat(Config.PACKAGE_VERSION);
59+
5660
const StreamState = {
5761
STOPPED: 0,
5862
STARTING: 1,
@@ -3968,12 +3972,21 @@ export const PhueMenu = GObject.registerClass({
39683972
* @param {Array} array with RGB
39693973
*/
39703974
_setSwitchColor(object, [r, g, b]) {
3971-
let color = new Clutter.Color({
3972-
red: r,
3973-
green: g,
3974-
blue: b,
3975-
alpha: 255
3976-
});
3975+
let color;
3976+
if (ShellVersion >= 47) {
3977+
color = new Cogl.Color();
3978+
color.red = r;
3979+
color.green = g;
3980+
color.blue = b;
3981+
color.alpha = 255;
3982+
} else {
3983+
color = new Clutter.Color({
3984+
red: r,
3985+
green: g,
3986+
blue: b,
3987+
alpha: 255
3988+
});
3989+
}
39773990

39783991
object.clear_effects();
39793992

extension/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
},
1212
"shell-version": [
1313
"45",
14-
"46"
14+
"46",
15+
"47"
1516
],
1617
"gettext-domain": "hue-lights",
1718
"url": "https://github.com/vchlum/hue-lights"

extension/phuepanelmenu.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ import GLib from 'gi://GLib';
3838
import St from 'gi://St';
3939
import GObject from 'gi://GObject';
4040
import Clutter from 'gi://Clutter';
41+
import Cogl from 'gi://Cogl';
42+
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
4143
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
4244
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
4345
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
4446
import * as Utils from './utils.js';
4547
import {Extension, gettext} from 'resource:///org/gnome/shell/extensions/extension.js';
4648

49+
const ShellVersion = parseFloat(Config.PACKAGE_VERSION);
50+
4751
const __ = gettext;
4852

4953
const PhueMenuPosition = {
@@ -157,22 +161,38 @@ export const PhuePanelMenu = GObject.registerClass({
157161

158162
case PhueIconPack.BRIGHT:
159163

160-
color = new Clutter.Color({
161-
red: 237,
162-
green: 237,
163-
blue: 237,
164-
alpha: 255
165-
});
164+
if (ShellVersion >= 47) {
165+
color = new Cogl.Color();
166+
color.red = 237;
167+
color.green = 237;
168+
color.blue = 237;
169+
color.alpha = 255;
170+
} else {
171+
color = new Clutter.Color({
172+
red: 237,
173+
green: 237,
174+
blue: 237,
175+
alpha: 255
176+
});
177+
}
166178
break;
167179

168180
case PhueIconPack.DARK:
169181

170-
color = new Clutter.Color({
171-
red: 40,
172-
green: 40,
173-
blue: 40,
174-
alpha: 255
175-
});
182+
if (ShellVersion >= 47) {
183+
color = new Cogl.Color();
184+
color.red = 40;
185+
color.green = 40;
186+
color.blue = 40;
187+
color.alpha = 255;
188+
} else {
189+
color = new Clutter.Color({
190+
red: 40,
191+
green: 40,
192+
blue: 40,
193+
alpha: 255
194+
});
195+
}
176196
break;
177197

178198
default:

extension/phuescreenshot.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@
3333
* THE SOFTWARE.
3434
*/
3535

36-
import Shell from 'gi://Shell';
37-
import GObject from 'gi://GObject';
38-
import Clutter from 'gi://Clutter';
36+
import Shell from 'gi://Shell';
37+
import GObject from 'gi://GObject';
38+
import Clutter from 'gi://Clutter';
39+
import Cogl from 'gi://Cogl';
40+
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
41+
42+
const ShellVersion = parseFloat(Config.PACKAGE_VERSION);
3943

4044
/**
4145
* PhueScreenshot class for taking screenshots
@@ -63,11 +67,16 @@ export const PhueScreenshot = GObject.registerClass({
6367
* @return {Object} color
6468
*/
6569
async getColorPixel(x, y) {
66-
let color = new Clutter.Color();
70+
let color;
71+
if (ShellVersion >= 47) {
72+
color = new Cogl.Color();
73+
} else {
74+
color = new Clutter.Color();
75+
}
6776
color.red = 0;
6877
color.green = 0;
6978
color.blue = 0;
70-
color.alfa = 0;
79+
color.alpha = 0;
7180

7281
if (!this.pixelWithinScreen(x, y)) {
7382
return color;

release.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)