Skip to content

Commit bfca8f3

Browse files
committed
chore: Refactor code structure for improved readability and maintainability
1 parent c93a23c commit bfca8f3

7 files changed

Lines changed: 3331 additions & 72 deletions

File tree

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
yarnPath: .yarn/releases/yarn-4.12.0.cjs
2+
nodeLinker: node-modules

Makefile

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

esbuild.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ build({
2929
// firefox102 // Since GJS 1.73.2
3030
target: 'firefox102',
3131
format: 'esm',
32+
alias: {
33+
// Not exported in @girs/gnome-shell v49; map directly to runtime resource
34+
'@girs/gnome-shell/ui/dash': 'resource:///org/gnome/shell/ui/dash.js',
35+
},
3236
external: ['gi://*', 'resource://*', 'system', 'gettext', 'cairo'],
3337
})
3438
.then(() => {

justfile

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
uuid := "aurora-shell@luminusos.com"
2+
ext_dir := env("HOME") / ".local/share/gnome-shell/extensions" / uuid
3+
4+
# List available commands
5+
default:
6+
@just --list
7+
8+
# Install dependencies
9+
deps:
10+
yarn install
11+
12+
# Build everything (CSS + TypeScript + zip)
13+
build: deps
14+
yarn build
15+
16+
# Type-check without emitting
17+
validate:
18+
yarn validate
19+
20+
# Lint the codebase
21+
lint:
22+
yarn lint
23+
24+
# Watch SCSS files for changes
25+
watch:
26+
yarn watch:css
27+
28+
# Install extension to GNOME Shell
29+
install: build
30+
mkdir -p {{ ext_dir }}
31+
cp dist/extension.js {{ ext_dir }}/
32+
cp dist/prefs.js {{ ext_dir }}/ 2>/dev/null || true
33+
cp dist/stylesheet.css {{ ext_dir }}/
34+
cp dist/stylesheet-light.css {{ ext_dir }}/
35+
cp dist/stylesheet-dark.css {{ ext_dir }}/
36+
cp dist/metadata.json {{ ext_dir }}/
37+
cp -r schemas {{ ext_dir }}/ 2>/dev/null || true
38+
glib-compile-schemas {{ ext_dir }}/schemas/ 2>/dev/null || true
39+
@echo "Installed at: {{ ext_dir }}"
40+
41+
# Uninstall extension
42+
uninstall:
43+
gnome-extensions disable {{ uuid }} 2>/dev/null || true
44+
rm -rf {{ ext_dir }}
45+
@echo "Uninstalled."
46+
47+
# Quick update (rebuild + copy files, no full install)
48+
quick: build
49+
cp dist/extension.js {{ ext_dir }}/
50+
cp dist/prefs.js {{ ext_dir }}/ 2>/dev/null || true
51+
cp dist/stylesheet.css {{ ext_dir }}/
52+
cp dist/stylesheet-light.css {{ ext_dir }}/
53+
cp dist/stylesheet-dark.css {{ ext_dir }}/
54+
cp dist/metadata.json {{ ext_dir }}/
55+
cp -r schemas {{ ext_dir }}/ 2>/dev/null || true
56+
glib-compile-schemas {{ ext_dir }}/schemas/ 2>/dev/null || true
57+
@echo "Files updated. Log out and back in to apply."
58+
59+
# Show recent extension logs
60+
logs:
61+
journalctl -b 0 /usr/bin/gnome-shell | grep "Aurora Shell" | tail -n 20
62+
63+
# Clean build artifacts
64+
clean:
65+
rm -rf dist
66+
67+
# Full clean (artifacts + dependencies)
68+
distclean: clean
69+
rm -rf node_modules
70+
71+
# Clean build + install
72+
all: clean build install
73+
@echo "Complete installation finished."

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
"clear": "rm -rf dist",
1111
"build:ts": "tsx esbuild.ts",
1212
"build:css": "tsx sass.config.ts",
13-
"build": "npm run clear && npm run build:css && npm run build:ts",
13+
"build": "yarn clear && yarn build:css && yarn build:ts",
1414
"lint": "cross-env NODE_OPTIONS=--import=tsx/esm eslint .",
1515
"validate": "tsc --noEmit",
1616
"watch:css": "tsx sass.config.ts --watch"
1717
},
1818
"devDependencies": {
19-
"chokidar": "^3.6.0",
2019
"@eslint/js": "^9.39.1",
2120
"@stylistic/eslint-plugin": "^2.6.4",
2221
"@tsconfig/strictest": "^2.0.6",
2322
"@types/adm-zip": "^0.5.7",
2423
"@types/node": "^24.10.1",
2524
"adm-zip": "^0.5.16",
25+
"chokidar": "^3.6.0",
2626
"cross-env": "^10.1.0",
2727
"esbuild": "^0.25.11",
2828
"eslint": "^9.39.1",
@@ -35,9 +35,10 @@
3535
"dependencies": {
3636
"@girs/adw-1": "1.9.0-4.0.0-beta.38",
3737
"@girs/gjs": "^4.0.0-beta.38",
38-
"@girs/gnome-shell": "^49.0.3",
38+
"@girs/gnome-shell": "^49.1.0",
3939
"@girs/gobject-2.0": "^2.86.0-4.0.0-beta.38",
4040
"@girs/shell-17": "^17.0.0-4.0.0-beta.38",
4141
"@girs/st-17": "^17.0.0-4.0.0-beta.38"
42-
}
42+
},
43+
"packageManager": "yarn@4.12.0"
4344
}

src/modules/registry.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { ThemeChanger } from "./themeChanger.ts";
2+
import { Dock } from "./dock.ts";
3+
import { NoOverview } from "./noOverview.ts";
4+
import { PipOnTop } from "./pipOnTop.ts";
5+
import type { Module } from "./module.ts";
6+
7+
/**
8+
* Module definition that includes both runtime and UI metadata
9+
*/
10+
export type ModuleDefinition = {
11+
/** Internal key used in the modules Map */
12+
key: string;
13+
/** GSettings schema key */
14+
settingsKey: string;
15+
/** Factory function to create module instance */
16+
create: () => Module;
17+
/** User-facing title for preferences UI */
18+
title: string;
19+
/** User-facing subtitle/description for preferences UI */
20+
subtitle: string;
21+
};
22+
23+
/**
24+
* Single source of truth for all available modules.
25+
* To add a new module:
26+
* 1. Import its class at the top
27+
* 2. Add one entry to this array
28+
* 3. Add corresponding key to gschema.xml
29+
*/
30+
export const MODULE_REGISTRY: ModuleDefinition[] = [
31+
{
32+
key: 'themeChanger',
33+
settingsKey: 'module-theme-changer',
34+
create: () => new ThemeChanger(),
35+
title: 'Theme Changer',
36+
subtitle: 'Monitors and synchronizes GNOME color scheme',
37+
},
38+
{
39+
key: 'dock',
40+
settingsKey: 'module-dock',
41+
create: () => new Dock(),
42+
title: 'Dock',
43+
subtitle: 'Custom dock with auto-hide and intellihide features',
44+
},
45+
{
46+
key: 'noOverview',
47+
settingsKey: 'module-no-overview',
48+
create: () => new NoOverview(),
49+
title: 'No Overview',
50+
subtitle: 'Disables the overview at startup',
51+
},
52+
{
53+
key: 'pipOnTop',
54+
settingsKey: 'module-pip-on-top',
55+
create: () => new PipOnTop(),
56+
title: 'Pip On Top',
57+
subtitle: 'Keeps Picture-in-Picture windows always on top',
58+
},
59+
];

0 commit comments

Comments
 (0)