File tree Expand file tree Collapse file tree 5 files changed +67
-24
lines changed Expand file tree Collapse file tree 5 files changed +67
-24
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ import GLib from 'gi://GLib';
40
40
import Meta from 'gi://Meta' ;
41
41
import Shell from 'gi://Shell' ;
42
42
import Mtk from 'gi://Mtk' ;
43
+ import Cogl from 'gi://Cogl' ;
44
+ import * as Config from 'resource:///org/gnome/shell/misc/config.js' ;
43
45
import * as Slider from 'resource:///org/gnome/shell/ui/slider.js' ;
44
46
import * as Main from 'resource:///org/gnome/shell/ui/main.js' ;
45
47
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js' ;
@@ -53,6 +55,8 @@ import * as AreaSelector from './areaselector.js';
53
55
import * as Queue from './queue.js' ;
54
56
import * as Utils from './utils.js' ;
55
57
58
+ const ShellVersion = parseFloat ( Config . PACKAGE_VERSION ) ;
59
+
56
60
const StreamState = {
57
61
STOPPED : 0 ,
58
62
STARTING : 1 ,
@@ -3968,12 +3972,21 @@ export const PhueMenu = GObject.registerClass({
3968
3972
* @param {Array } array with RGB
3969
3973
*/
3970
3974
_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
+ }
3977
3990
3978
3991
object . clear_effects ( ) ;
3979
3992
Original file line number Diff line number Diff line change 11
11
},
12
12
"shell-version" : [
13
13
" 45" ,
14
- " 46"
14
+ " 46" ,
15
+ " 47"
15
16
],
16
17
"gettext-domain" : " hue-lights" ,
17
18
"url" : " https://github.com/vchlum/hue-lights"
Original file line number Diff line number Diff line change @@ -38,12 +38,16 @@ import GLib from 'gi://GLib';
38
38
import St from 'gi://St' ;
39
39
import GObject from 'gi://GObject' ;
40
40
import Clutter from 'gi://Clutter' ;
41
+ import Cogl from 'gi://Cogl' ;
42
+ import * as Config from 'resource:///org/gnome/shell/misc/config.js' ;
41
43
import * as Main from 'resource:///org/gnome/shell/ui/main.js' ;
42
44
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js' ;
43
45
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js' ;
44
46
import * as Utils from './utils.js' ;
45
47
import { Extension , gettext } from 'resource:///org/gnome/shell/extensions/extension.js' ;
46
48
49
+ const ShellVersion = parseFloat ( Config . PACKAGE_VERSION ) ;
50
+
47
51
const __ = gettext ;
48
52
49
53
const PhueMenuPosition = {
@@ -157,22 +161,38 @@ export const PhuePanelMenu = GObject.registerClass({
157
161
158
162
case PhueIconPack . BRIGHT :
159
163
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
+ }
166
178
break ;
167
179
168
180
case PhueIconPack . DARK :
169
181
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
+ }
176
196
break ;
177
197
178
198
default :
Original file line number Diff line number Diff line change 33
33
* THE SOFTWARE.
34
34
*/
35
35
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 ) ;
39
43
40
44
/**
41
45
* PhueScreenshot class for taking screenshots
@@ -63,11 +67,16 @@ export const PhueScreenshot = GObject.registerClass({
63
67
* @return {Object } color
64
68
*/
65
69
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
+ }
67
76
color . red = 0 ;
68
77
color . green = 0 ;
69
78
color . blue = 0 ;
70
- color . alfa = 0 ;
79
+ color . alpha = 0 ;
71
80
72
81
if ( ! this . pixelWithinScreen ( x , y ) ) {
73
82
return color ;
You can’t perform that action at this time.
0 commit comments