diff --git a/sources/border.js b/sources/border.js index 859e801..0934068 100644 --- a/sources/border.js +++ b/sources/border.js @@ -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; diff --git a/stylesheet.css b/stylesheet.css index ac2f025..46eb5d6 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -1,6 +1,5 @@ .fairy-border { border-width: 3px; - border-color: rgba(236, 94, 94, 1); border-style: solid; /* border-radius: 14px; */ }