Link border settings

This commit is contained in:
2023-05-19 17:55:55 +09:00
parent bc53a65b89
commit 7c13c3d3d6
2 changed files with 27 additions and 3 deletions

View File

@@ -14,19 +14,42 @@ const Me = ExtensionUtils.getCurrentExtension();
var BorderManager = GObject.registerClass(
class BorderManager extends GObject.Object {
_init(state) {
_init(state, settings) {
super._init();
this._state = state;
this._settings = settings;
this._border = null;
this._renderCount = 0;
this.settings = {
show: true,
color: "#ff0000",
};
}
enable() {
this._border = new St.Bin({ style_class: "fairy-border" });
this.settings = {
show: this._settings.get_boolean("focus-border"),
color: this._settings.get_string("focus-border-color"),
};
this._border = new St.Bin({
style: `border-color: ${this.settings.color};`,
style_class: "fairy-border",
});
if (global.window_group) global.window_group.add_child(this._border);
this._settings.connect("changed", () => {
this.settings = {
show: this._settings.get_boolean("focus-border"),
color: this._settings.get_string("focus-border-color"),
};
this._border.set_style(`border-color: ${this.settings.color};`);
this.updateBorders();
});
}
disable() {
this._settings.disconnect("changed");
this._border.destroy();
this._border = null;
}
@@ -36,6 +59,8 @@ var BorderManager = GObject.registerClass(
this._border.hide();
this._renderCount++;
if (!this.settings.show) return;
const state = this._state.monitors[this._state.focusedMon];
const handle = state.focused;
if (!handle || state.layout === "monocle") return;

View File

@@ -1,6 +1,5 @@
.fairy-border {
border-width: 3px;
border-color: rgba(236, 94, 94, 1);
border-style: solid;
/* border-radius: 14px; */
}