init commit
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
**node_modules
|
||||||
|
package-lock.json
|
||||||
30
Makefile
Normal file
30
Makefile
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
NAME=floarbar
|
||||||
|
DOMAIN=tomtroeger.de
|
||||||
|
|
||||||
|
.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
|
||||||
4
ambient.d.ts
vendored
Normal file
4
ambient.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import "@girs/gjs";
|
||||||
|
import "@girs/gjs/dom";
|
||||||
|
import "@girs/gnome-shell/ambient";
|
||||||
|
import "@girs/gnome-shell/extensions/global";
|
||||||
20
extension.ts
Normal file
20
extension.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import GLib from "gi://GLib";
|
||||||
|
import Gio from "gi://Gio";
|
||||||
|
import Meta from "gi://Meta";
|
||||||
|
import Shell from "gi://Shell";
|
||||||
|
import * as Main from "resource:///org/gnome/shell/ui/main.js";
|
||||||
|
import { Extension } from "resource:///org/gnome/shell/extensions/extension.js";
|
||||||
|
|
||||||
|
export default class MyExtension extends Extension {
|
||||||
|
gsettings?: Gio.Settings;
|
||||||
|
animationsEnabled: boolean = true;
|
||||||
|
|
||||||
|
enable() {
|
||||||
|
this.gsettings = this.getSettings();
|
||||||
|
this.animationsEnabled = this.gsettings!.get_value("padding-inner").deepUnpack() ?? 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
disable() {
|
||||||
|
this.gsettings = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
10
metadata.json
Normal file
10
metadata.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "float bar",
|
||||||
|
"description": "Adaptive floating topbar",
|
||||||
|
"uuid": "floatbar@tomtroeger.de",
|
||||||
|
"settings-schema": "org.gnome.shell.extensions.my-extension",
|
||||||
|
"shell-version": [
|
||||||
|
"46"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
21
package.json
Normal file
21
package.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "floatbar",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "A TypeScript GNOME Extension",
|
||||||
|
"type": "module",
|
||||||
|
"private": true,
|
||||||
|
"repository": {},
|
||||||
|
"author": "Tom Tröger <tomtroeger@mail.com>",
|
||||||
|
"license": "LGPL-3.0-or-later",
|
||||||
|
"bugs": {},
|
||||||
|
"sideEffects": false,
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^9.6.0",
|
||||||
|
"eslint-plugin-jsdoc": "^48.5.0",
|
||||||
|
"typescript": "^5.5.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@girs/gjs": "^4.0.0-beta.5",
|
||||||
|
"@girs/gnome-shell": "^46.0.0-beta8"
|
||||||
|
}
|
||||||
|
}
|
||||||
51
prefs.ts
Normal file
51
prefs.ts
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import Gtk from "gi://Gtk";
|
||||||
|
import Adw from "gi://Adw";
|
||||||
|
import Gio from "gi://Gio";
|
||||||
|
import { ExtensionPreferences, gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
|
||||||
|
|
||||||
|
export default class GnomeRectanglePreferences extends ExtensionPreferences {
|
||||||
|
_settings?: Gio.Settings;
|
||||||
|
|
||||||
|
fillPreferencesWindow(window: Adw.PreferencesWindow) {
|
||||||
|
this._settings = this.getSettings();
|
||||||
|
|
||||||
|
const page = new Adw.PreferencesPage({
|
||||||
|
title: _("General"),
|
||||||
|
iconName: "dialog-information-symbolic",
|
||||||
|
});
|
||||||
|
|
||||||
|
const animationGroup = new Adw.PreferencesGroup({
|
||||||
|
title: _("Animation"),
|
||||||
|
description: _("Configure move/resize animation"),
|
||||||
|
});
|
||||||
|
page.add(animationGroup);
|
||||||
|
|
||||||
|
const animationEnabled = new Adw.SwitchRow({
|
||||||
|
title: _("Enabled"),
|
||||||
|
subtitle: _("Wether to animate windows"),
|
||||||
|
});
|
||||||
|
animationGroup.add(animationEnabled);
|
||||||
|
|
||||||
|
const paddingGroup = new Adw.PreferencesGroup({
|
||||||
|
title: _("Paddings"),
|
||||||
|
description: _("Configure the padding between windows"),
|
||||||
|
});
|
||||||
|
page.add(paddingGroup);
|
||||||
|
|
||||||
|
const paddingInner = new Adw.SpinRow({
|
||||||
|
title: _("Inner"),
|
||||||
|
subtitle: _("Padding between windows"),
|
||||||
|
adjustment: new Gtk.Adjustment({
|
||||||
|
lower: 0,
|
||||||
|
upper: 1000,
|
||||||
|
stepIncrement: 1,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
paddingGroup.add(paddingInner);
|
||||||
|
|
||||||
|
window.add(page);
|
||||||
|
|
||||||
|
this._settings!.bind("animate", animationEnabled, "active", Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
this._settings!.bind("padding-inner", paddingInner, "value", Gio.SettingsBindFlags.DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
20
tsconfig.json
Normal file
20
tsconfig.json
Normal file
@@ -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