Skip to content

Commit

Permalink
transparent-panels@germanfr: Properly update on monitors changed (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
anaximeno authored Jan 5, 2024
1 parent c77ed76 commit 5466032
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ MyExtension.prototype = {
this.settings.bind("panel-bottom", "enable_position_bottom", this.on_settings_changed);
this.settings.bind("panel-left", "enable_position_left", this.on_settings_changed);

this._signals.connect(Main.layoutManager, 'monitors-changed', () => this.on_state_change(-1), this);

this._signals.connect(Main.layoutManager, 'monitors-changed', this.on_monitors_changed, this);
this._classname = this.theme_defined ? this.transparency_type : this.transparency_type + INTERNAL_PREFIX;

Gettext.bindtextdomain(meta.uuid, GLib.get_home_dir() + "/.local/share/locale");
Expand Down Expand Up @@ -162,6 +161,19 @@ MyExtension.prototype = {
this.on_state_change(-1);
},

on_monitors_changed: function () {
Main.getPanels().forEach(panel => this.make_transparent(panel, false));

this._panel_status = new Array(Main.panelManager.panelCount);
for(let i = 0; i < this._panel_status.length; i++)
this._panel_status[i] = false;

this.policy.disable();
this.policy = new Policies.MaximizedPolicy(this);
this.policy.enable();
this.on_state_change(-1);
},

// This will be called only once, the first time the extension is loaded.
// It's not worth it to create a separate class, so we build everything here.
_show_startup_notification: function () {
Expand Down

0 comments on commit 5466032

Please sign in to comment.