CHANGE: removed actor disconnect due to error

This commit is contained in:
2024-07-02 21:20:22 +01:00
parent d6a850c3d8
commit fa41490406
6 changed files with 40 additions and 27 deletions

View File

@@ -8,17 +8,14 @@ all: dist/extension.js
node_modules: package.json node_modules: package.json
npm install npm install
dist/extension.js dist/prefs.js: node_modules dist/extension.js: node_modules
tsc tsc
dist/stylesheet.css: stylesheet.css dist/stylesheet.css: stylesheet.css
cp stylesheet.css dist/ 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 $(NAME).zip: dist/extension.js dist/stylesheet.css
@cp -r schemas dist/
@cp metadata.json dist/ @cp metadata.json dist/
@(cd dist && zip ../$(NAME).zip -9r .) @(cd dist && zip ../$(NAME).zip -9r .)
@@ -27,14 +24,10 @@ pack: $(NAME).zip
install: $(NAME).zip install: $(NAME).zip
@touch ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN) @touch ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN)
@rm -rf ~/.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: clean:
@rm -rf dist node_modules $(NAME).zip @rm -rf dist node_modules $(NAME).zip
test: test:
@dbus-run-session -- gnome-shell --nested --wayland @dbus-run-session -- gnome-shell --nested --wayland
full:
@make install
@make test

16
dist/extension.js vendored
View File

@@ -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))]); this._actorSignalIds.set(global.window_manager, [global.window_manager.connect("switch-workspace", this._updateFloating.bind(this))]);
} }
disable() { disable() {
for (const actorSignalIds of [this._actorSignalIds, this._windowSignalIds]) { // for (const actorSignalIds of [this._actorSignalIds, this._windowSignalIds]) {
for (const [actor, signalIds] of actorSignalIds) { // for (const [actor, signalIds] of actorSignalIds!) {
for (const signalId of signalIds) { // for (const signalId of signalIds) {
actor.disconnect(signalId); // console.log("SignalID ", signalId);
} // console.log("Actor ", actor instanceof Clutter.Actor);
} // }
} // }
// }
this._actorSignalIds?.clear(); this._actorSignalIds?.clear();
this._windowSignalIds?.clear(); this._windowSignalIds?.clear();
this._setFloat(false); this._setFloat(false);
@@ -80,7 +81,6 @@ export default class MyExtension extends Extension {
this._setFloat(!maximized); this._setFloat(!maximized);
} }
_setFloat(float) { _setFloat(float) {
console.log("Float: ", float);
Main.panel.add_style_class_name(float ? "floating" : "solid"); Main.panel.add_style_class_name(float ? "floating" : "solid");
Main.panel.remove_style_class_name(float ? "solid" : "floating"); Main.panel.remove_style_class_name(float ? "solid" : "floating");
} }

10
dist/metadata.json vendored Normal file
View 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"
]
}

9
dist/stylesheet.css vendored Normal file
View File

@@ -0,0 +1,9 @@
#panel.floating {
margin: 3px;
border-radius: 9999px;
}
#panel.solid {
margin: 0;
border-radius: 0;
}

View File

@@ -1,5 +1,6 @@
import Gio from "gi://Gio"; import Gio from "gi://Gio";
import Meta from "gi://Meta"; import Meta from "gi://Meta";
import Clutter from "gi://Clutter";
import { Extension } from "resource:///org/gnome/shell/extensions/extension.js"; import { Extension } from "resource:///org/gnome/shell/extensions/extension.js";
import { EventEmitter } from "resource:///org/gnome/shell/misc/signals.js"; import { EventEmitter } from "resource:///org/gnome/shell/misc/signals.js";
import * as Main from "resource:///org/gnome/shell/ui/main.js"; import * as Main from "resource:///org/gnome/shell/ui/main.js";
@@ -53,13 +54,14 @@ export default class MyExtension extends Extension {
} }
disable() { disable() {
for (const actorSignalIds of [this._actorSignalIds, this._windowSignalIds]) { // for (const actorSignalIds of [this._actorSignalIds, this._windowSignalIds]) {
for (const [actor, signalIds] of actorSignalIds!) { // for (const [actor, signalIds] of actorSignalIds!) {
for (const signalId of signalIds) { // for (const signalId of signalIds) {
actor.disconnect(signalId); // console.log("SignalID ", signalId);
} // console.log("Actor ", actor instanceof Clutter.Actor);
} // }
} // }
// }
this._actorSignalIds?.clear(); this._actorSignalIds?.clear();
this._windowSignalIds?.clear(); this._windowSignalIds?.clear();
@@ -98,7 +100,6 @@ export default class MyExtension extends Extension {
} }
_setFloat(float: boolean) { _setFloat(float: boolean) {
console.log("Float: ", float);
Main.panel.add_style_class_name(float ? "floating" : "solid"); Main.panel.add_style_class_name(float ? "floating" : "solid");
Main.panel.remove_style_class_name(float ? "solid" : "floating"); Main.panel.remove_style_class_name(float ? "solid" : "floating");
} }

BIN
floatbar.zip Normal file

Binary file not shown.