Disabling extension doesn't restore normal behaviour
fawtytoo opened this issue · comments
I'm using Debian Testing/Bookworm GS 41.
Default behaviour in GS 41 is to show the workspace overview every time a workspace becomes empty or you switch to an empty workspace. Not just at startup/login.
This extension works, but when I disable it, it doesn't restore normal behaviour.
I did not know that G1 41 changed the overview behavior.
That's odd because I restore the show overview state at disabling.
Could you try:
Main.layoutManager.startInOverview = true;
in looking glass then see if overview appears as intended?
I do use GS 40 in Ubuntu 22.04 dev, so I cannot easily check this.
Code to try:
const Main = imports.ui.main;
class Extension {
constructor() {
this._realHasOverview = Main.sessionMode.hasOverview;
this._realStartInOverview = Main.layoutManager.startInOverview;
}
enable() {
if (!Main.layoutManager._startingUp) {
return;
}
Main.sessionMode.hasOverview = false;
// handle Ubuntu's method:
if (Main.layoutManager.startInOverview) {
Main.layoutManager.startInOverview = false;
}
Main.layoutManager.connect('startup-complete', () => {
Main.sessionMode.hasOverview = this._realHasOverview;
});
}
disable() {
Main.sessionMode.hasOverview = this._realHasOverview;
Main.layoutManager.startInOverview = this._realStartInOverview;
}
}
function init() {
return new Extension();
}
I may have made a mistake. I normally use GS 3.38 and am using GS 41 to test my own (and others) extensions.
To confirm, is showing the overview only default behaviour at login?
I may have had another extension interfering with the Shell causing me to see something else. Not sure.
login only, afaik
Then accept my apologies for raising this issue.
Can I ask though, if this only affects login, why are you restoring the Main.sessionMode.hasOverview variable when the extension is disabled? Seems a bit pointless.
Surely, wouldn't this suffice?
const Main = imports.ui.main;
function init()
{
}
function enable()
{
Main.sessionMode.hasOverview = false;
}
function disable()
{
}
That's because it would remove completely overview!
In the code I posted above, I suspected at first that the Ubuntu/Debian's startInOverview function's name was misleading.