diff --git a/Makefile b/Makefile index d530394..654b3f8 100644 --- a/Makefile +++ b/Makefile @@ -8,17 +8,14 @@ all: dist/extension.js node_modules: package.json npm install -dist/extension.js dist/prefs.js: node_modules +dist/extension.js: node_modules tsc dist/stylesheet.css: stylesheet.css cp stylesheet.css dist/ -schemas/gschemas.compiled: schemas/org.gnome.shell.extensions.$(NAME).gschema.xml - glib-compile-schemas schemas -$(NAME).zip: dist/extension.js dist/prefs.js dist/stylesheet.css schemas/gschemas.compiled - @cp -r schemas dist/ +$(NAME).zip: dist/extension.js dist/stylesheet.css @cp metadata.json dist/ @(cd dist && zip ../$(NAME).zip -9r .) @@ -27,14 +24,10 @@ pack: $(NAME).zip install: $(NAME).zip @touch ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN) @rm -rf ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN) - @cp -r dist ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN) + @mv dist ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN) clean: @rm -rf dist node_modules $(NAME).zip test: - @dbus-run-session -- gnome-shell --nested --wayland - -full: - @make install - @make test \ No newline at end of file + @dbus-run-session -- gnome-shell --nested --wayland \ No newline at end of file diff --git a/dist/extension.js b/dist/extension.js index d1572a0..bafe23e 100644 --- a/dist/extension.js +++ b/dist/extension.js @@ -38,13 +38,14 @@ export default class MyExtension extends Extension { this._actorSignalIds.set(global.window_manager, [global.window_manager.connect("switch-workspace", this._updateFloating.bind(this))]); } disable() { - for (const actorSignalIds of [this._actorSignalIds, this._windowSignalIds]) { - for (const [actor, signalIds] of actorSignalIds) { - for (const signalId of signalIds) { - actor.disconnect(signalId); - } - } - } + // for (const actorSignalIds of [this._actorSignalIds, this._windowSignalIds]) { + // for (const [actor, signalIds] of actorSignalIds!) { + // for (const signalId of signalIds) { + // console.log("SignalID ", signalId); + // console.log("Actor ", actor instanceof Clutter.Actor); + // } + // } + // } this._actorSignalIds?.clear(); this._windowSignalIds?.clear(); this._setFloat(false); @@ -80,7 +81,6 @@ export default class MyExtension extends Extension { this._setFloat(!maximized); } _setFloat(float) { - console.log("Float: ", float); Main.panel.add_style_class_name(float ? "floating" : "solid"); Main.panel.remove_style_class_name(float ? "solid" : "floating"); } diff --git a/dist/metadata.json b/dist/metadata.json new file mode 100644 index 0000000..c6df5c3 --- /dev/null +++ b/dist/metadata.json @@ -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" + ] + } + \ No newline at end of file diff --git a/dist/stylesheet.css b/dist/stylesheet.css new file mode 100644 index 0000000..11b31f5 --- /dev/null +++ b/dist/stylesheet.css @@ -0,0 +1,9 @@ +#panel.floating { + margin: 3px; + border-radius: 9999px; +} + +#panel.solid { + margin: 0; + border-radius: 0; +} diff --git a/extension.ts b/extension.ts index 441aff5..4cc60ac 100644 --- a/extension.ts +++ b/extension.ts @@ -1,5 +1,6 @@ import Gio from "gi://Gio"; import Meta from "gi://Meta"; +import Clutter from "gi://Clutter"; import { Extension } from "resource:///org/gnome/shell/extensions/extension.js"; import { EventEmitter } from "resource:///org/gnome/shell/misc/signals.js"; import * as Main from "resource:///org/gnome/shell/ui/main.js"; @@ -53,13 +54,14 @@ export default class MyExtension extends Extension { } disable() { - for (const actorSignalIds of [this._actorSignalIds, this._windowSignalIds]) { - for (const [actor, signalIds] of actorSignalIds!) { - for (const signalId of signalIds) { - actor.disconnect(signalId); - } - } - } + // for (const actorSignalIds of [this._actorSignalIds, this._windowSignalIds]) { + // for (const [actor, signalIds] of actorSignalIds!) { + // for (const signalId of signalIds) { + // console.log("SignalID ", signalId); + // console.log("Actor ", actor instanceof Clutter.Actor); + // } + // } + // } this._actorSignalIds?.clear(); this._windowSignalIds?.clear(); @@ -98,7 +100,6 @@ export default class MyExtension extends Extension { } _setFloat(float: boolean) { - console.log("Float: ", float); Main.panel.add_style_class_name(float ? "floating" : "solid"); Main.panel.remove_style_class_name(float ? "solid" : "floating"); } diff --git a/floatbar.zip b/floatbar.zip new file mode 100644 index 0000000..c471faa Binary files /dev/null and b/floatbar.zip differ