Skip to content

Commit 9c55b12

Browse files
authored
Merge gnome48Extensions: init (#403591)
2 parents 1a5f51a + 697c547 commit 9c55b12

File tree

10 files changed

+2076
-1256
lines changed

10 files changed

+2076
-1256
lines changed

nixos/tests/gnome-extensions.nix

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,14 @@ import ./make-test-python.nix (
121121
# "${run "gsettings set org.gnome.shell disable-extension-version-validation true"}"
122122
# )
123123
124-
# Assert that some extension is in a specific state
125-
def checkState(target, extension):
126-
state = machine.succeed(
124+
def getState(extension):
125+
return machine.succeed(
127126
f"${run "gnome-extensions info {extension}"} | grep '^ State: .*$'"
128127
)
128+
129+
# Assert that some extension is in a specific state
130+
def checkState(target, extension):
131+
state = getState(extension)
129132
assert target in state, f"{state} instead of {target}"
130133
131134
def checkExtension(extension, disable):
@@ -143,6 +146,10 @@ import ./make-test-python.nix (
143146
# Enable and optionally disable
144147
145148
machine.succeed(f"${run "gnome-extensions enable {extension}"}")
149+
wait_time = 5
150+
while getState(extension) == "ACTIVATING" and (wait_time := wait_time - 1) > 0:
151+
machine.log(f"Extension {extension} is still activating, waiting {wait_time} more seconds")
152+
machine.sleep(1)
146153
checkState("ACTIVE", extension)
147154
148155
if disable:

pkgs/desktops/gnome/extensions/README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
# GNOME Shell extensions
22

3-
All extensions are packaged automatically. They can be found in the `pkgs.gnomeXYExtensions` for XY being a GNOME version. The package names are the extension’s UUID, which can be a bit unwieldy to use. `pkgs.gnomeExtensions` is a set of manually curated extensions that match the current `gnome.gnome-shell` versions. Their name is human-friendly, compared to the other extensions sets. Some of its extensions are manually packaged.
3+
All extensions are packaged automatically. They can be found in the `pkgs.gnomeXYExtensions` for XY being a GNOME version. The package names are the extension’s UUID, which can be a bit unwieldy to use. `pkgs.gnomeExtensions` is a set of manually curated extensions that match the current `pkgs.gnome-shell` versions. Their name is human-friendly, compared to the other extensions sets. Some of its extensions are manually packaged.
44

55
## Automatically packaged extensions
66

77
The actual packages are created by `buildGnomeExtension.nix`, provided the correct arguments are fed into it. The important extension data is stored in `extensions.json`, one line/item per extension. That file is generated by running `update-extensions.py`. Furthermore, the automatic generated names are dumped in `collisions.json` for manual inspection. `extensionRenames.nix` contains new names for all extensions that collide.
88

99
### Extensions updates
1010

11-
For everyday updates,
11+
#### For everyday updates,
1212

1313
1. Run `update-extensions.py`.
1414
2. Update `extensionRenames.nix` according to the comment at the top.
1515

16-
For GNOME updates,
16+
#### To package the extensions for new GNOME version,
1717

18-
1. Add a new `gnomeXYExtensions` set
19-
2. Remove old ones for GNOME versions we don’t want to support any more
20-
3. Update `supported_versions` in `./update-extensions.py` and re-run it
21-
4. Change `gnomeExtensions` to the new version
22-
5. Update `./extensionsRenames.nix` accordingly
23-
6. Update `all-packages.nix` accordingly (grep for `gnomeExtensions`)
18+
1. Add a new `gnomeXYExtensions` set in `default.nix`.
19+
2. Update `all-packages.nix` accordingly. (grep for `gnomeExtensions`)
20+
3. Update `supported_versions` in `update-extensions.py`.
21+
4. Follow the [For everyday updates](#for-everyday-updates) section.
22+
23+
#### For GNOME updates,
24+
25+
1. Follow the [To package the extensions for new GNOME version](#to-package-the-extensions-for-new-gnome-version) section if required.
26+
2. Update `versions_to_merge` variable in `./update-extensions.py`.
27+
3. Run `update-extensions.py --skip-fetch`, and update `extensionRenames.nix` according to the comment at the top.
28+
4. Update `gnomeExtensions` in `default.nix` to the new versions.
2429

2530
## Manually packaged extensions
2631

pkgs/desktops/gnome/extensions/collisions.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@
44
55
],
66
"persian-calendar": [
7-
8-
"PersianCalendar@oxygenws.com"
7+
"PersianCalendar@oxygenws.com",
8+
99
],
1010
"system-monitor": [
11-
12-
11+
12+
1313
],
1414
"fuzzy-clock": [
15-
15+
"FuzzyClock@fire-man-x",
1616
"FuzzyClock@johngoetz",
17-
"FuzzyClock@fire-man-x"
17+
1818
],
1919
"battery-time": [
20-
21-
20+
21+
22+
2223
],
2324
"nepali-calendar": [
24-
"nepali-date@biplab",
25-
25+
26+
"nepali-date@biplab"
2627
],
2728
"mouse-follows-focus": [
2829
@@ -33,8 +34,8 @@
3334
"power-profile@fthx"
3435
],
3536
"fullscreen-to-empty-workspace": [
36-
"fullscreen-to-empty-workspace@aiono.dev",
37-
"fullscreen-to-empty-workspace2@corgijan.dev"
37+
"fullscreen-to-empty-workspace2@corgijan.dev",
38+
"fullscreen-to-empty-workspace@aiono.dev"
3839
],
3940
"eur-usd": [
4041

pkgs/desktops/gnome/extensions/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ rec {
7676
gnome45Extensions = mapUuidNames (produceExtensionsList "45");
7777
gnome46Extensions = mapUuidNames (produceExtensionsList "46");
7878
gnome47Extensions = mapUuidNames (produceExtensionsList "47");
79+
gnome48Extensions = mapUuidNames (produceExtensionsList "48");
7980

8081
# Keep the last three versions in here
8182
gnomeExtensions = lib.trivial.pipe (gnome45Extensions // gnome46Extensions // gnome47Extensions) [

pkgs/desktops/gnome/extensions/extensionOverrides.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
vte,
2828
wrapGAppsHook3,
2929
xdg-utils,
30+
gtk4,
31+
desktop-file-utils,
32+
xdg-user-dirs,
3033
}:
3134
let
3235
# Helper method to reduce redundancy
@@ -128,7 +131,10 @@ lib.trivial.pipe super [
128131
inherit gjs;
129132
util_linux = util-linux;
130133
xdg_utils = xdg-utils;
131-
nautilus_gsettings_path = "${glib.getSchemaPath nautilus}";
134+
gtk_update_icon_cache = "${gtk4.out}/bin/gtk4-update-icon-cache";
135+
update_desktop_database = "${desktop-file-utils.out}/bin/update-desktop-database";
136+
xdg_user_dirs = lib.getExe xdg-user-dirs;
137+
nautilus_gsettings_path = glib.getSchemaPath nautilus;
132138
})
133139
];
134140
}))

pkgs/desktops/gnome/extensions/extensionOverridesPatches/gtk4-ding_at_smedius.gitlab.com.patch

Lines changed: 72 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,59 @@
1-
diff --git a/app/ding.js b/app/ding.js
2-
index 1062bc7..c312d48 100755
1+
diff --git a/app/adw-ding.js b/app/adw-ding.js
2+
index 42cb878c..929ddce2 100755
33
--- a/app/adw-ding.js
44
+++ b/app/adw-ding.js
55
@@ -1,4 +1,4 @@
66
-#!/usr/bin/env -S gjs -m
77
+#!@gjs@/bin/gjs -m
88

9-
/* DING: Desktop Icons New Generation for GNOME Shell
9+
/* ADW-DING: Desktop Icons New Generation for GNOME Shell
1010
*
11+
@@ -535,7 +535,7 @@ const adWDingApp = GObject.registerClass(
12+
]);
13+
14+
const updated = await GLib.spawn_command_line_async(
15+
- 'gtk-update-icon-cache ' +
16+
+ '@gtk_update_icon_cache@ ' +
17+
'-q -t -f ' +
18+
`${iconCachePath}`
19+
);
20+
@@ -566,7 +566,7 @@ const adWDingApp = GObject.registerClass(
21+
// and we need to do it manually for the app to be
22+
// available sooner
23+
const updated = await GLib.spawn_command_line_async(
24+
- 'update-desktop-database -q ' +
25+
+ '@update_desktop_database@ -q ' +
26+
`${GLib.path_get_dirname(appDesktopFile)}`
27+
);
28+
29+
diff --git a/app/adwPreferencesWindow.js b/app/adwPreferencesWindow.js
30+
index 93d53554..8f5bb8fe 100644
31+
--- a/app/adwPreferencesWindow.js
32+
+++ b/app/adwPreferencesWindow.js
33+
@@ -540,7 +540,7 @@ const AdwPreferencesWindow = class {
34+
}
35+
36+
setDesktopFolder(path) {
37+
- const command = 'xdg-user-dirs-update --set DESKTOP';
38+
+ const command = '@xdg_user_dirs@/bin/xdg-user-dirs-update --set DESKTOP';
39+
40+
try {
41+
GLib.spawn_command_line_async(
42+
@@ -564,7 +564,7 @@ const AdwPreferencesWindow = class {
43+
}
44+
45+
getCurrentDesktopFolder() {
46+
- const command = 'xdg-user-dir DESKTOP';
47+
+ const command = '@xdg_user_dirs@/bin/xdg-user-dir DESKTOP';
48+
const decoder = new TextDecoder();
49+
const [, out,, status] = GLib.spawn_command_line_sync(command);
50+
1151
diff --git a/app/enums.js b/app/enums.js
12-
index 2b541f3..594d288 100644
52+
index 5434fa7a..e36d3670 100644
1353
--- a/app/enums.js
1454
+++ b/app/enums.js
15-
@@ -124,7 +124,8 @@ export const THUMBNAILS_DIR = '.cache/thumbnails';
16-
export const DND_HOVER_TIMEOUT = 500; // In milliseconds
55+
@@ -134,7 +134,8 @@ export const THUMBNAILS_DIR = '.cache/thumbnails';
56+
export const DND_HOVER_TIMEOUT = 1500; // In milliseconds
1757
export const DND_SHELL_HOVER_POLL = 200; // In milliseconds
1858
export const TOOLTIP_HOVER_TIMEOUT = 1000; // In milliseconds
1959
-export const XDG_EMAIL_CMD = 'xdg-email';
@@ -23,68 +63,68 @@ index 2b541f3..594d288 100644
2363
export const ZIP_CMD = 'zip';
2464
export const ZIP_CMD_OPTIONS = '-r';
2565
diff --git a/app/preferences.js b/app/preferences.js
26-
index 6849a86..83a7247 100644
66+
index 95ffe60b..75370403 100644
2767
--- a/app/preferences.js
2868
+++ b/app/preferences.js
29-
@@ -29,6 +29,7 @@ const Preferences = class {
30-
this._programVersion = Data.programversion;
69+
@@ -30,6 +30,7 @@ const Preferences = class {
70+
this._mainApp = Data.mainApp;
3171
this._Enums = Data.Enums;
3272
let schemaSource = GioSSS.get_default();
3373
+ const schemaSourceNautilus = Gio.SettingsSchemaSource.new_from_directory('@nautilus_gsettings_path@', Gio.SettingsSchemaSource.get_default(), true);
3474
this._desktopManager = null;
3575

36-
// Gtk
37-
@@ -36,7 +37,7 @@ const Preferences = class {
38-
this.gtkSettings = new Gio.Settings({settings_schema: schemaGtk});
76+
// Adw Style Manager
77+
@@ -52,7 +53,7 @@ const Preferences = class {
3978

4079
// Gnome Files
41-
- let schemaObj = schemaSource.lookup(this._Enums.SCHEMA_NAUTILUS, true);
42-
+ let schemaObj = schemaSourceNautilus.lookup(this._Enums.SCHEMA_NAUTILUS, true);
80+
const schemaObj =
81+
- schemaSource.lookup(this._Enums.SCHEMA_NAUTILUS, true);
82+
+ schemaSourceNautilus.lookup(this._Enums.SCHEMA_NAUTILUS, true);
83+
4384
if (!schemaObj) {
4485
this.nautilusSettings = null;
45-
this.CLICK_POLICY_SINGLE = false;
46-
@@ -48,7 +49,7 @@ const Preferences = class {
47-
86+
@@ -69,7 +70,7 @@ const Preferences = class {
4887

4988
// Compression
50-
- const compressionSchema = schemaSource.lookup(this._Enums.SCHEMA_NAUTILUS_COMPRESSION, true);
51-
+ const compressionSchema = schemaSourceNautilus.lookup(this._Enums.SCHEMA_NAUTILUS_COMPRESSION, true);
52-
if (!compressionSchema)
89+
const compressionSchema =
90+
- schemaSource.lookup(this._Enums.SCHEMA_NAUTILUS_COMPRESSION, true);
91+
+ schemaSourceNautilus.lookup(this._Enums.SCHEMA_NAUTILUS_COMPRESSION, true);
92+
93+
if (!compressionSchema) {
5394
this.nautilusCompression = null;
54-
else
5595
diff --git a/dingManager.js b/dingManager.js
56-
index f1b497f..29f2156 100644
96+
index 7a0de9e3..bbc23704 100644
5797
--- a/dingManager.js
5898
+++ b/dingManager.js
59-
@@ -401,7 +401,7 @@ const DingManager = class {
99+
@@ -482,7 +482,7 @@ const DingManager = class {
60100
async _doKillAllOldDesktopProcesses() {
61101
const procFolder = Gio.File.new_for_path('/proc');
62102
const processes = await FileUtils.enumerateDir(procFolder);
63103
- const thisPath = `gjs ${GLib.build_filenamev([
64104
+ const thisPath = `@gjs@/bin/gjs ${GLib.build_filenamev([
65105
this.path,
66106
'app',
67-
'ding.js',
68-
@@ -425,7 +425,7 @@ const DingManager = class {
69-
}
107+
'adw-ding.js',
108+
@@ -510,7 +510,7 @@ const DingManager = class {
70109

71110
if (contents.startsWith(thisPath)) {
72-
- let proc = new Gio.Subprocess({argv: ['/bin/kill', filename]});
73-
+ let proc = new Gio.Subprocess({argv: ['@util_linux@/bin/kill', filename]});
111+
let proc =
112+
- new Gio.Subprocess({argv: ['/bin/kill', filename]});
113+
+ new Gio.Subprocess({argv: ['@util_linux@/bin/kill', filename]});
114+
74115
proc.init(null);
75116
console.log(`Killing old DING process ${filename}`);
76-
await proc.wait_async_promise(null);
77117
diff --git a/prefs.js b/prefs.js
78-
index 5ed03f6..5302836 100644
118+
index 50430fa5..82fca2e3 100644
79119
--- a/prefs.js
80120
+++ b/prefs.js
81-
@@ -30,7 +30,8 @@ export default class dingPreferences extends ExtensionPreferences {
121+
@@ -34,7 +34,8 @@ export default class dingPreferences extends ExtensionPreferences {
82122
const schemaSource = GioSSS.get_default();
83123
const schemaGtk = schemaSource.lookup(Enums.SCHEMA_GTK, true);
84124
const gtkSettings = new Gio.Settings({settings_schema: schemaGtk});
85125
- const schemaNautilus = schemaSource.lookup(Enums.SCHEMA_NAUTILUS, true);
86126
+ const schemaSourceNautilus = Gio.SettingsSchemaSource.new_from_directory('@nautilus_gsettings_path@', Gio.SettingsSchemaSource.get_default(), true);
87127
+ const schemaNautilus = schemaSourceNautilus.lookup(Enums.SCHEMA_NAUTILUS, true);
88128
const version = this.metadata['version-name'];
129+
89130
let nautilusSettings;
90-
if (!schemaNautilus)

pkgs/desktops/gnome/extensions/extensionRenames.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"[email protected]" = "fuzzy-clock-2";
1818
"FuzzyClock@johngoetz" = "fuzzy-clock";
1919

20+
"[email protected]" = "battery-time-3";
2021
"[email protected]" = "battery-time-2";
2122
"[email protected]" = "battery-time";
2223

0 commit comments

Comments
 (0)