Skip to content

Commit dbe34e0

Browse files
committed
port to Gnome 45 and new make system
1 parent 5dcbcb8 commit dbe34e0

File tree

131 files changed

+1222
-1151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+1222
-1151
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
extension/schemas/gschemas.compiled
3+
extension/preferences.gresource
4+
build/
5+
6+
*.po~
7+
*.ui~
8+
*.ui#

Makefile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
SHELL = bash
2+
3+
4+
BUILD_DIR ?= build
5+
PNG_FILES = $(wildcard ./docs/*.png)
6+
RAW_PATH = "$(BUILD_DIR)/$(UUID).shell-extension.zip"
7+
BUNDLE_PATH = "$(BUILD_DIR)/$(UUID).zip"
8+
9+
.PHONY: build package check release install uninstall clean
10+
11+
build: clean
12+
@mkdir -p $(BUILD_DIR)
13+
$(MAKE) package
14+
@mv -v $(RAW_PATH) $(BUNDLE_PATH)
15+
gresource:
16+
@cd "extension/resources"; \
17+
glib-compile-resources --target=../preferences.gresource preferences.gresource.xml
18+
package: gresource
19+
@mkdir -p $(BUILD_DIR)
20+
@echo "Packing files..."
21+
@cd "extension"; \
22+
gnome-extensions pack --force \
23+
--extra-source=../LICENSE \
24+
--extra-source=../CHANGELOG.md \
25+
--extra-source=../README.md \
26+
--extra-source=crypto \
27+
--extra-source=media \
28+
--extra-source=areaselector.js \
29+
--extra-source=colorpicker.js \
30+
--extra-source=dtlsclient.js \
31+
--extra-source=extensionmenu.js \
32+
--extra-source=modalselector.js \
33+
--extra-source=phue.js \
34+
--extra-source=phueapi.js \
35+
--extra-source=phueentertainmentapi.js \
36+
--extra-source=phuepanelmenu.js \
37+
--extra-source=phuescreenshot.js \
38+
--extra-source=phuesyncbox.js \
39+
--extra-source=phuesyncboxapi.js \
40+
--extra-source=prefspage.js \
41+
--extra-source=queue.js \
42+
--extra-source=syncboxmenu.js \
43+
--extra-source=utils.js \
44+
--extra-source=preferences.gresource \
45+
-o ../$(BUILD_DIR)/
46+
check:
47+
@if [[ ! -f $(BUNDLE_PATH) ]]; then \
48+
echo -e "\nWARNING! Extension zip couldn't be found"; exit 1; \
49+
elif [[ "$$(stat -c %s $(BUNDLE_PATH))" -gt 4096000 ]]; then \
50+
echo -e "\nWARNING! The extension is too big to be uploaded to the extensions website, keep it smaller than 4096 KB"; exit 1; \
51+
fi
52+
install:
53+
@if [[ ! -f $(BUNDLE_PATH) ]]; then \
54+
$(MAKE) build; \
55+
fi
56+
gnome-extensions install $(BUNDLE_PATH) --force
57+
uninstall:
58+
gnome-extensions uninstall "$(UUID)"
59+
clean:
60+
@rm -rfv $(BUILD_DIR)
61+
@rm -rfv "$(UUID).zip"
62+
@rm -rfv extension/ui/*.ui~ extension/ui/*.ui#

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This extension allows controlling Philips Hue HDMI sync box on local network. Yo
2121
This application makes use of fast changing light effects conditions alone, or in combination with certain content on the screen it may trigger previously undetected epileptic symptoms or seizures in persons who have no history of prior seizures or epilepsy.
2222

2323
## Supported Gnome Shell version
24-
This extension supports Gnome Shell verison 40 and above.
24+
This extension supports Gnome Shell verison 45 and above.
2525

2626
## Installation from e.g.o
2727
https://extensions.gnome.org/extension/3737/hue-lights
@@ -30,7 +30,12 @@ https://extensions.gnome.org/extension/3737/hue-lights
3030

3131
1. `git clone https://github.com/vchlum/hue-lights.git`
3232
1. `cd hue-lights`
33-
1. `./release.sh`
34-
1. `gnome-extensions install [email protected]`
33+
1. `make build`
34+
1. `make install`
3535
1. Log out & Log in
3636
1. `gnome-extensions enable [email protected]`
37+
38+
## Install dependencies
39+
- These are only required to install from source
40+
- `make`
41+
- `gnome-shell` (`gnome-extensions` command)

extension.js

Lines changed: 0 additions & 114 deletions
This file was deleted.

areaselector.js renamed to extension/areaselector.js

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

36-
const GObject = imports.gi.GObject;
37-
const Shell = imports.gi.Shell;
38-
const Meta = imports.gi.Meta;
39-
const Main = imports.ui.main;
40-
const St = imports.gi.St;
41-
const Clutter = imports.gi.Clutter;
36+
import GObject from 'gi://GObject';
37+
import Shell from 'gi://Shell';
38+
import Meta from 'gi://Meta';
39+
import St from 'gi://St';
40+
import Clutter from 'gi://Clutter';
41+
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
4242

4343
/**
4444
* AreaSelector class for selection area on screen.
@@ -48,7 +48,7 @@ const Clutter = imports.gi.Clutter;
4848
* @private
4949
* @return {Object} instance
5050
*/
51-
var AreaSelector = GObject.registerClass({
51+
export var AreaSelector = GObject.registerClass({
5252
GTypeName: "AreaSelector",
5353
Signals: {
5454
"area-selected": {},

colorpicker.js renamed to extension/colorpicker.js

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
* JavaScript class for showing window with colors and picking the color
55
*
66
* @author Václav Chlumský
7-
* @copyright Copyright 2022, Václav Chlumský.
7+
* @copyright Copyright 2023, Václav Chlumský.
88
*/
99

1010
/**
1111
* @license
1212
* The MIT License (MIT)
1313
*
14-
* Copyright (c) 2022 Václav Chlumský
14+
* Copyright (c) 2023 Václav Chlumský
1515
*
1616
* Permission is hereby granted, free of charge, to any person obtaining a copy
1717
* of this software and associated documentation files (the "Software"), to deal
@@ -32,23 +32,19 @@
3232
* THE SOFTWARE.
3333
*/
3434

35-
const St = imports.gi.St;
36-
const Gio = imports.gi.Gio;
37-
const ModalDialog = imports.ui.modalDialog;
38-
const Clutter = imports.gi.Clutter;
39-
const GObject = imports.gi.GObject;
40-
const Main = imports.ui.main;
41-
const Slider = imports.ui.slider;
42-
const PopupMenu = imports.ui.popupMenu;
43-
const Gdk = imports.gi.Gdk;
44-
const ExtensionUtils = imports.misc.extensionUtils;
45-
const Me = ExtensionUtils.getCurrentExtension();
46-
const Utils = Me.imports.utils;
47-
const Params = imports.misc.params;
48-
const PhueScreenshot = Me.imports.phuescreenshot;
49-
50-
const Gettext = imports.gettext.domain('hue-lights');
51-
const __ = Gettext.gettext;
35+
import GObject from 'gi://GObject';
36+
import St from 'gi://St';
37+
import Clutter from 'gi://Clutter';
38+
import * as Slider from 'resource:///org/gnome/shell/ui/slider.js';
39+
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
40+
import * as ModalDialog from 'resource:///org/gnome/shell/ui/modalDialog.js';
41+
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
42+
import * as PhueScreenshot from './phuescreenshot.js';
43+
import * as Utils from './utils.js';
44+
import * as Params from 'resource:///org/gnome/shell/misc/params.js';
45+
import {Extension, gettext} from 'resource:///org/gnome/shell/extensions/extension.js';
46+
47+
const __ = gettext;
5248

5349
/**
5450
* ColorSelectorButton button.
@@ -109,7 +105,7 @@ class ColorSelectorButton extends St.Bin {
109105
* @constructor
110106
* @return {Object} object
111107
*/
112-
var ColorPickerBox = GObject.registerClass({
108+
export var ColorPickerBox = GObject.registerClass({
113109
GTypeName: "ColorPickerBox",
114110
Signals: {
115111
'color-picked': {},
@@ -123,7 +119,7 @@ var ColorPickerBox = GObject.registerClass({
123119
* @method _init
124120
* @private
125121
*/
126-
_init(params) {
122+
_init(mainDir, params) {
127123
params = Params.parse(params, {
128124
useColorWheel: true,
129125
useWhiteBox: true,
@@ -141,6 +137,7 @@ var ColorPickerBox = GObject.registerClass({
141137
this._useColorWheel = params.useColorWheel;
142138
this._useWhiteBox = params.useWhiteBox;
143139
this._showBrightness = params.showBrightness;
140+
this._mainDir = mainDir;
144141
}
145142

146143
/**
@@ -170,7 +167,7 @@ var ColorPickerBox = GObject.registerClass({
170167
this._centerObject(mainbox);
171168

172169
if (this._useColorWheel) {
173-
let colorWheel = new ColorSelectorButton(Me.dir.get_path() + '/media/color-wheel.svg');
170+
let colorWheel = new ColorSelectorButton(this._mainDir.get_path() + '/media/color-wheel.svg');
174171
signal = colorWheel.connect(
175172
"button-press-event",
176173
async () => {
@@ -193,7 +190,7 @@ var ColorPickerBox = GObject.registerClass({
193190

194191
if (this._useWhiteBox) {
195192
let whiteBox = new ColorSelectorButton(
196-
Me.dir.get_path() + '/media/temperature-bar.svg',
193+
this._mainDir.get_path() + '/media/temperature-bar.svg',
197194
{
198195
buttonWidth: 256,
199196
buttonHeight: 32
@@ -312,7 +309,7 @@ var ColorPickerBox = GObject.registerClass({
312309
* @constructor
313310
* @return {Object} modal dialog instance
314311
*/
315-
var ColorPicker = GObject.registerClass({
312+
export var ColorPicker = GObject.registerClass({
316313
GTypeName: "ColorPicker",
317314
Signals: {
318315
'opened': {},
@@ -329,15 +326,16 @@ var ColorPicker = GObject.registerClass({
329326
* @method _init
330327
* @private
331328
*/
332-
_init(params) {
329+
_init(mainDir, settings, params) {
333330
params = Params.parse(params, {
334331
useColorWheel: true,
335332
useWhiteBox: true,
336333
});
334+
this._mainDir = mainDir;
337335

338336
super._init();
339337

340-
this._ = Utils.checkGettextEnglish(__);
338+
this._ = Utils.checkGettextEnglish(__, settings);
341339

342340
this._signals = {};
343341
let signal;
@@ -359,11 +357,14 @@ var ColorPicker = GObject.registerClass({
359357
key: Clutter.Escape
360358
}]);
361359

362-
this.colorPickerBox = new ColorPickerBox({
363-
useColorWheel: params.useColorWheel,
364-
useWhiteBox: params.useWhiteBox,
365-
showBrightness: true
366-
});
360+
this.colorPickerBox = new ColorPickerBox(
361+
this._mainDir,
362+
{
363+
useColorWheel: params.useColorWheel,
364+
useWhiteBox: params.useWhiteBox,
365+
showBrightness: true,
366+
}
367+
);
367368

368369
signal = this.colorPickerBox.connect(
369370
"color-picked",

crypto/aes.js renamed to extension/crypto/aes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function keyExpansion(roundLimit, key) {
200200
return result;
201201
}
202202

203-
function encrypt(input, key) {
203+
export function encrypt(input, key) {
204204
let round;
205205
let roundLimit;
206206
let w;

0 commit comments

Comments
 (0)