feat: adding in support for typescript code completion to the gnome extension.js
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
NAME=my-extension
|
||||||
|
DOMAIN=example.com
|
||||||
|
|
||||||
|
.PHONY: all pack install clean
|
||||||
|
|
||||||
|
all: dist/extension.js
|
||||||
|
|
||||||
|
node_modules: package.json
|
||||||
|
npm install
|
||||||
|
|
||||||
|
dist/extension.js dist/prefs.js: node_modules
|
||||||
|
tsc
|
||||||
|
|
||||||
|
schemas/gschemas.compiled: schemas/org.gnome.shell.extensions.$(NAME).gschema.xml
|
||||||
|
glib-compile-schemas schemas
|
||||||
|
|
||||||
|
$(NAME).zip: dist/extension.js dist/prefs.js schemas/gschemas.compiled
|
||||||
|
@cp -r schemas dist/
|
||||||
|
@cp metadata.json dist/
|
||||||
|
@(cd dist && zip ../$(NAME).zip -9r .)
|
||||||
|
|
||||||
|
pack: $(NAME).zip
|
||||||
|
|
||||||
|
install: $(NAME).zip
|
||||||
|
@touch ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN)
|
||||||
|
@rm -rf ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN)
|
||||||
|
@mv dist ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@rm -rf dist node_modules $(NAME).zip
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
import "@girs/gjs";
|
||||||
|
import "@girs/gjs/dom";
|
||||||
|
import "@girs/gnome-shell/ambient";
|
||||||
|
import "@girs/gnome-shell/extensions/global";
|
||||||
+1
-57
@@ -13,6 +13,7 @@ export default class ActiveBorderExtension extends Extension {
|
|||||||
this.lastFocusedWindow = null;
|
this.lastFocusedWindow = null;
|
||||||
this._focusSignal = null;
|
this._focusSignal = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
enable() {
|
enable() {
|
||||||
console.log("STARTING PRETTY BORDERS!")
|
console.log("STARTING PRETTY BORDERS!")
|
||||||
// Connect to the focus window signal to track the active window
|
// Connect to the focus window signal to track the active window
|
||||||
@@ -107,60 +108,3 @@ export default class ActiveBorderExtension extends Extension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// class ActiveBorderExtension extends Extension {
|
|
||||||
// constructor(metadata) {
|
|
||||||
// super(metadata);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// enable() {
|
|
||||||
// // Connect to the focus window signal to track the active window
|
|
||||||
// this._focusSignal = global.display.connect('notify::focus-window', () => {
|
|
||||||
// this._updateBorder(global.display.focus_window);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // Set initial border on the current window, if there is one
|
|
||||||
// this._updateBorder(global.display.focus_window);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// disable() {
|
|
||||||
// // Disconnect the signal and remove any existing borders
|
|
||||||
// if (this._focusSignal) {
|
|
||||||
// global.display.disconnect(this._focusSignal);
|
|
||||||
// this._focusSignal = null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Clear the border on the last focused window if it exists
|
|
||||||
// if (lastFocusedWindow) {
|
|
||||||
// this._clearBorder(lastFocusedWindow);
|
|
||||||
// lastFocusedWindow = null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _updateBorder(window) {
|
|
||||||
// // Clear the previous border if there's a last focused window
|
|
||||||
// if (lastFocusedWindow) {
|
|
||||||
// this._clearBorder(lastFocusedWindow);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Set a new border for the currently focused window
|
|
||||||
// if (window) {
|
|
||||||
// this._setBorder(window);
|
|
||||||
// lastFocusedWindow = window;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _setBorder(window) {
|
|
||||||
// if (!window || !window.get_compositor_private()) return;
|
|
||||||
// window.get_compositor_private().set_style(`
|
|
||||||
// border: 4px solid rgba(0, 150, 255, 0.8);
|
|
||||||
// border-radius: 5px;
|
|
||||||
// `);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// _clearBorder(window) {
|
|
||||||
// if (!window || !window.get_compositor_private()) return;
|
|
||||||
// window.get_compositor_private().set_style("");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|||||||
Generated
+1834
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^9.14.0",
|
||||||
|
"eslint-plugin-jsdoc": "^50.4.3",
|
||||||
|
"typescript": "^5.6.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@girs/gjs": "^4.0.0-beta.18",
|
||||||
|
"@girs/gnome-shell": "^47.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"outDir": "./dist",
|
||||||
|
"sourceMap": false,
|
||||||
|
"strict": true,
|
||||||
|
"target": "ES2022",
|
||||||
|
"lib": [
|
||||||
|
"ES2022"
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"ambient.d.ts",
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"extension.ts",
|
||||||
|
"prefs.ts"
|
||||||
|
],
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user