Skip to content

Commit

Permalink
fix: refresh style with timeout after enable #77
Browse files Browse the repository at this point in the history
  • Loading branch information
neuromorph committed Oct 3, 2024
1 parent 1c20cab commit 8f1f9fb
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions openbar@neuromorph/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -1464,11 +1464,6 @@ export default class Openbar extends Extension {
}
);

// Apply the initial style
this.updatePanelStyle(null, 'enabled');
let menustyle = this._settings.get_boolean('menustyle');
this.applyMenuStyles(panel, menustyle);

// OpenBar runtime directory
const userRunDir = GLib.get_user_runtime_dir();
this.obarRunDir = Gio.File.new_for_path(`${userRunDir}/io.github.neuromorph.openbar`);
Expand Down Expand Up @@ -1499,6 +1494,17 @@ export default class Openbar extends Extension {
// Add Open Bar Flatpak Overrides
StyleSheets.saveFlatpakOverrides(this, 'enable');

// Apply the initial style
this.updatePanelStyle(null, 'enabled');
let menustyle = this._settings.get_boolean('menustyle');
this.applyMenuStyles(panel, menustyle);
// Refresh to fix any indicators added during initial styling
this.enableStyleTimeoutId = setTimeout(() => {
this.updatePanelStyle(null, 'enabled');
this.applyMenuStyles(panel, menustyle);
this.enableStyleTimeoutId = null;
}, 1000);

// Set initial Window Max Bar
this.onWindowMaxBar();

Expand Down Expand Up @@ -1560,6 +1566,10 @@ export default class Openbar extends Extension {
clearTimeout(this.postStartupId);
this.postStartupId = null;
}
if(this.enableStyleTimeoutId > 0) {
clearTimeout(this.enableStyleTimeoutId);
this.enableStyleTimeoutId = null;
}
if(this.fittsEnableTimeoutId > 0) {
clearTimeout(this.fittsEnableTimeoutId);
this.fittsEnableTimeoutId = null;
Expand Down

0 comments on commit 8f1f9fb

Please sign in to comment.