Fixed duplicate workspaces (closes #1196)

This commit is contained in:
mauro-balades
2024-09-04 19:05:20 +02:00
parent b199007543
commit a8178bb16f
2 changed files with 26 additions and 1 deletions

View File

@@ -314,7 +314,32 @@ var gZenLooksAndFeel = {
var gZenWorkspacesSettings = { var gZenWorkspacesSettings = {
init() { init() {
Services.prefs.addObserver("zen.workspaces.enabled", this);
window.addEventListener("unload", () => {
Services.prefs.removeObserver("zen.workspaces.enabled", this);
});
}, },
async observe(subject, topic, data) {
await this.onWorkspaceChange(Services.prefs.getBoolPref("zen.workspaces.enabled"));
},
async onWorkspaceChange(checked) {
if (checked) {
let buttonIndex = await confirmRestartPrompt(
true,
1,
true,
false
);
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
Services.startup.quit(
Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart
);
return;
}
}
}
}; };
var gZenCKSSettings = { var gZenCKSSettings = {