ADD: make install and dist folder with compiled extension
This commit is contained in:
4
Makefile
4
Makefile
@@ -26,8 +26,8 @@ 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)
|
||||
@rm -rf ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN)
|
||||
@cp -r dist ~/.local/share/gnome-shell/extensions/$(NAME)@$(DOMAIN)
|
||||
|
||||
clean:
|
||||
@rm -rf dist node_modules $(NAME).zip
|
||||
|
||||
8
README.md
Normal file
8
README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Floatbar
|
||||
|
||||
## Installation:
|
||||
``` bash
|
||||
git clone https://git.letsstein.de/tom/floatbar.git
|
||||
cd floatbar
|
||||
make install
|
||||
```
|
||||
87
dist/extension.js
vendored
Normal file
87
dist/extension.js
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
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";
|
||||
export default class MyExtension extends Extension {
|
||||
button;
|
||||
settings;
|
||||
float = false;
|
||||
updateFloat = new EventEmitter();
|
||||
_actorSignalIds;
|
||||
_windowSignalIds;
|
||||
_workspace;
|
||||
enable() {
|
||||
this._workspace = global.workspaceManager.get_active_workspace();
|
||||
this._windowSignalIds = new Map();
|
||||
this._actorSignalIds = new Map();
|
||||
// this.button = new ToggleButton(this);
|
||||
// Main.panel.addToStatusArea(this.uuid, this.button);
|
||||
this._actorSignalIds.set(Main.overview, [
|
||||
Main.overview.connect("showing", () => this._updateFloating.bind(this)),
|
||||
Main.overview.connect("hiding", () => this._updateFloating.bind(this)),
|
||||
]);
|
||||
this._actorSignalIds.set(Main.sessionMode, [Main.sessionMode.connect("updated", () => this._updateFloating.bind(this))]);
|
||||
for (const window_actor of global.get_window_actors()) {
|
||||
this._onWindowActorAdded(window_actor.get_parent(), window_actor);
|
||||
}
|
||||
this._workspace.connect("window-added", (workspace, window) => {
|
||||
setTimeout(() => {
|
||||
console.log("window-added ", window.title);
|
||||
this._onWindowActorAdded.bind(this)(workspace, window.get_compositor_private());
|
||||
}, 10);
|
||||
});
|
||||
this._workspace.connect("window-removed", (workspace, window) => {
|
||||
setTimeout(() => {
|
||||
console.log("window-removed ", window.title);
|
||||
this._onWindowActorRemoved.bind(this)(workspace, window.get_compositor_private());
|
||||
}, 10);
|
||||
});
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
this._actorSignalIds?.clear();
|
||||
this._windowSignalIds?.clear();
|
||||
this._setFloat(false);
|
||||
}
|
||||
_onWindowActorAdded(container, metaWindowActor) {
|
||||
if (metaWindowActor.metaWindow.skipTaskbar)
|
||||
return;
|
||||
if (this._windowSignalIds === undefined)
|
||||
return;
|
||||
this._windowSignalIds.set(metaWindowActor.metaWindow.title, [
|
||||
metaWindowActor.connect("notify::allocation", this._updateFloating.bind(this)),
|
||||
metaWindowActor.connect("notify::visible", this._updateFloating.bind(this)),
|
||||
]);
|
||||
}
|
||||
_onWindowActorRemoved(container, metaWindowActor) {
|
||||
if (this._windowSignalIds === undefined)
|
||||
return;
|
||||
this._updateFloating();
|
||||
for (const signalId of this._windowSignalIds.get(metaWindowActor.metaWindow.title)) {
|
||||
metaWindowActor.disconnect(signalId);
|
||||
}
|
||||
this._windowSignalIds.delete("test");
|
||||
}
|
||||
_updateFloating() {
|
||||
const workspace_manager = global.workspaceManager;
|
||||
const active_workspace = workspace_manager.get_active_workspace();
|
||||
const windows = active_workspace.list_windows().filter((metaWindow) => {
|
||||
return !metaWindow.skip_taskbar && metaWindow.showing_on_its_workspace() && !metaWindow.is_hidden();
|
||||
});
|
||||
const maximized = windows.some((metaWindow) => {
|
||||
return metaWindow.maximizedHorizontally;
|
||||
});
|
||||
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");
|
||||
}
|
||||
}
|
||||
10
dist/metadata.json
vendored
Normal file
10
dist/metadata.json
vendored
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"
|
||||
]
|
||||
}
|
||||
|
||||
42
dist/prefs.js
vendored
Normal file
42
dist/prefs.js
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
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;
|
||||
fillPreferencesWindow(window) {
|
||||
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: _("Floating Window"),
|
||||
});
|
||||
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("float", animationEnabled, "active", Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind("padding-inner", paddingInner, "value", Gio.SettingsBindFlags.DEFAULT);
|
||||
}
|
||||
}
|
||||
15
dist/schemas/org.gnome.shell.extensions.floatbar.gschema.xml
vendored
Normal file
15
dist/schemas/org.gnome.shell.extensions.floatbar.gschema.xml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<schemalist>
|
||||
<schema id="org.gnome.shell.extensions.my-extension" path="/org/gnome/shell/extensions/my-extension/">
|
||||
<key name="padding-inner" type="i">
|
||||
<default>8</default>
|
||||
<summary>Inner padding</summary>
|
||||
<description>Padding between windows</description>
|
||||
</key>
|
||||
<key name="float" type="b">
|
||||
<default>true</default>
|
||||
<summary>Floating</summary>
|
||||
<description>Whether the topbar floats or not</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
||||
9
dist/stylesheet.css
vendored
Normal file
9
dist/stylesheet.css
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
#panel.floating {
|
||||
margin: 3px;
|
||||
border-radius: 9999px;
|
||||
}
|
||||
|
||||
#panel.solid {
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
Reference in New Issue
Block a user