Skip to content

Commit

Permalink
small clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmaSd committed Feb 29, 2024
1 parent a685178 commit a46b96c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class MainWindow {
"exitBehaviorV2": "Ask Confirmation",
};
#cookies: { [key in Flags | "screenSaverCookie"]?: number } = {};

constructor(app: Adw_.Application) {
const savedState = localStorage.getItem("state");
// NOTE: If we update the state with new apis, the spreading will make sure that users who have old versions will get default values
Expand Down Expand Up @@ -182,6 +183,11 @@ export class MainWindow {
this.#win.present();
}

updateState(state: Partial<State>) {
this.#state = { ...this.#state, ...state };
localStorage.setItem("state", JSON.stringify(this.#state));
}

#showPreferences = () => {
this.#preferencesMenu.present();
};
Expand Down Expand Up @@ -262,11 +268,6 @@ export class MainWindow {
if (shortcuts) this.#app.set_accels_for_action(`app.${name}`, shortcuts);
};

updateState(state: Partial<State>) {
this.#state = { ...this.#state, ...state };
localStorage.setItem("state", JSON.stringify(this.#state));
}

#toggleSuspend = (yes: boolean) => {
const idleRowActive = this.#idleRow.get_active().valueOf();
if (yes) {
Expand Down

0 comments on commit a46b96c

Please sign in to comment.