Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]Gnome shell 42 not support #229

Open
plumlis opened this issue Mar 18, 2022 · 34 comments
Open

[BUG]Gnome shell 42 not support #229

plumlis opened this issue Mar 18, 2022 · 34 comments
Assignees
Labels

Comments

@plumlis
Copy link

plumlis commented Mar 18, 2022

Fedora 36 with Gnome-shell 42

Extension can't be installed and enabled.

See log:

JS ERROR: Extension [email protected]: Error: Wrong type undefined; string expected
setIcon@resource:///org/gnome/shell/ui/popupMenu.js:479:13
_init@resource:///org/gnome/shell/ui/popupMenu.js:471:14
_init@/home/plum/.local/share/gnome-shell/extensions/[email protected]/base.js:98:19
PopupBaseMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:73:4
PopupImageMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:454:1
SoundDeviceMenuItem@/home/plum/.local/share/gnome-shell/extensions/[email protected]/base.js:92:9
_deviceAdded@/home/plum/.local/share/gnome-shell/extensions/[email protected]/base.js:325:19
_onControlStateChanged@/home/plum/.local/share/gnome-shell/extensions/[email protected]/base.js:280:22
SoundDeviceChooserBase@/home/plum/.local/share/gnome-shell/extensions/[email protected]/base.js:231:18
SoundOutputDeviceChooser@/home/plum/.local/share/gnome-shell/extensions/[email protected]/extension.js:33:9
enable@/home/plum/.local/share/gnome-shell/extensions/[email protected]/extension.js:155:36
_callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:181:32
loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:363:26
_onInstallButtonPressed@resource:///org/gnome/shell/ui/extensionDownloader.js:267:35
Async*addButton/<@resource:///org/gnome/shell/ui/dialog.js:132:41

@carlwgeorge
Copy link

I get a similar error in the journal when I enable this extension. I'm using 4a6f0f2 with gnome-shell-42~rc-3.fc36 on Fedora 36.

JS ERROR: Extension [email protected]: Error: Wrong type undefined; string expected
setIcon@resource:///org/gnome/shell/ui/popupMenu.js:479:13
_init@resource:///org/gnome/shell/ui/popupMenu.js:471:14
_init@/usr/share/gnome-shell/extensions/[email protected]/base.js:99:19
PopupBaseMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:73:4
PopupImageMenuItem@resource:///org/gnome/shell/ui/popupMenu.js:454:1
SoundDeviceMenuItem@/usr/share/gnome-shell/extensions/[email protected]/base.js:93:9
_deviceAdded@/usr/share/gnome-shell/extensions/[email protected]/base.js:326:19
_onControlStateChanged@/usr/share/gnome-shell/extensions/[email protected]/base.js:281:22
SoundDeviceChooserBase@/usr/share/gnome-shell/extensions/[email protected]/base.js:231:18
SoundOutputDeviceChooser@/usr/share/gnome-shell/extensions/[email protected]/extension.js:35:9
enable@/usr/share/gnome-shell/extensions/[email protected]/extension.js:157:36
_callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:181:32
_onEnabledExtensionsChanged/<@resource:///org/gnome/shell/ui/extensionSystem.js:507:35
_onEnabledExtensionsChanged@resource:///org/gnome/shell/ui/extensionSystem.js:507:14
createCheckedMethod/<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:533:46
enableExtension@resource:///org/gnome/shell/ui/extensionSystem.js:208:29
EnableExtension@resource:///org/gnome/shell/ui/shellDBus.js:447:38
_handleMethodCall@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:310:38
_wrapJSObject/<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:387:34

@fortizc
Copy link

fortizc commented Mar 24, 2022

Same error in Debian Sid

@iadegesso
Copy link

Here too on my Gentoo

@palWorx
Copy link

palWorx commented Mar 27, 2022

Same error on Debian sid. Is this extension still in active development, because the developer didn't even react to any of the last issues and there seems to be no action since beginning of february?

@justinkb
Copy link

justinkb commented Mar 27, 2022

I've found the problem:

the code after the superclass constructor never gets executed, in this case the _init function (which is obviously important)

Why? no idea

edit: potentially related to gjs upgrade 1.72.0 that came with gnome 42. since 1.71.1 (prelease), they changed how constructor() functions and _init() functions work with GObject subclasses

@bhack
Copy link

bhack commented Mar 27, 2022

These are the API changes/upgrade tips: https://gjs.guide/extensions/upgrading/gnome-shell-42.html

@justinkb
Copy link

justinkb commented Mar 27, 2022 via email

jeffmahoney added a commit to jeffmahoney/gse-sound-output-device-chooser that referenced this issue Mar 28, 2022
According to
https://gjs.guide/guides/gobject/subclassing.html#subclassing-gobject,
Javascript classes that subclass GObject must implement an _init()
initializer instead of using a regular constructor.  The ProfileMenuItem
and SoundDeviceMenuItem each subclass PopupMenu classes that ultimately
subclass a GObject class.

This has just worked because the constructor itself was called, and it
in turn was calling the correct _init methods.  gjs commit 16032db6cd2
(Correctly chain constructor prototypes to enable static inheritance)
made it so that constructors are called directly but the gjs
behavior of calling _init still occurs.  It occurs using this._init(),
though so what has happened is as follows.

SoundDeviceChooserBase._deviceAdded instantiates a SoundDeviceMenuItem
with four arguments that are passed to the constructor.  In turn,
the superclass's constructor is called with two of those arguments.  Due
to the change in gjs, the original class's _init routine is called from
the superclass's constructor but with only the two arguments passed to
it.  We end up with icon_name = null, which predictably blows up later.
The same issue affects ProfileMenuItem since the superclass's
constructor is only called with one argument instead of two.

The fix is simple: Follow the guidelines in the gjs guide for
subclassing GObject and just remove the constructors for both of those
classes in favor of just using _init().  The _init() methods already do
the right thing in calling the superclass's _init() method themselves.
AFAICT, this change should be compatible back to very old gjs versions
since that appears to be a long-standing guideline.
@jeffmahoney
Copy link
Contributor

I've created PR #230 with the above commit. It fixes it for me. The explanation is in the commit message but the tl;dr is that this extension has had a bug that violated the guidelines for subclassing GObject but it was harmless until gjs 1.72.0.

@justinkb
Copy link

@jeffmahoney tested on nixos and confirmed working perfectly!

@minax007
Copy link

Dear @jeffmahoney

Thanks for your efforts!

I saw that @justinkb confirmed that it is working.

So I tested your reworked base.js file on my Debian Sid system with Gnome Shell 42 but it doesn't work.

It still shows "Extension initialising ..." even though I have adopted the shell version in the metadata.json file and restarted.

Do you have any idea what could be missing?

In the gnome-control-center my system shows "Gnome shell 42.0".

But if I check it via the command line it shows "Gnome shell 41.4".

So it could also be a problem of my system.

@kgshank
Copy link
Owner

kgshank commented Mar 29, 2022

I was held up with work. I will push the changes soon. Thanks @jeffmahoney for the PR. I will merge and test the changes

kgshank added a commit that referenced this issue Mar 29, 2022
Properly fix for GNOME 42 / gjs 1.72.0 (#229).
@palWorx
Copy link

palWorx commented Mar 29, 2022

@minax007
I am also on Debian sid and it worked for me even after F2+r instead of a restart, so i guess you possibly have a problem in the metadata.json change. Whats different to your setup is that i switched off the compatibility check for extensions with dconf.

@justinkb
Copy link

justinkb commented Mar 29, 2022 via email

@minax007
Copy link

minax007 commented Mar 29, 2022

Dear @palWorx

thanks for the hint.

I have activated in dconf-editor the parameter "“disable-extension-version-validation”.

And have downloaded the latest build.

And now it works!

Thanks to all of of the contributors and supporters!

@justinkb
Copy link

justinkb commented Mar 29, 2022 via email

@palWorx
Copy link

palWorx commented Mar 29, 2022

@justinkb @minax007
My system is going crazy right now, I have undone the setting "disable-extension-version-validation" and am currently adjusting the metadata.json outdated extension by extension until I find the one that makes my system unusable. The moment I start Firefox it's game over.

@minax007
Copy link

@palWorx

I can confirm that I have no problems with Debian Sid.

So I think that it is not related to this gnome shell extension.

Potentially you have another extension which caused the problem when disabling the extenion version validation.

@palWorx
Copy link

palWorx commented Mar 29, 2022

@minax007
It's definitlely not "gse-sound-output-device-chooser" which runs again like a charm. It's about to not follow my advice to activate "disable-extension-version-validation" till this "change-from gnome-41-to-42"-Horror has ended. At least for me, in all these years, no change has had such a negative impact as the switch from gnome 41 to 42.

@plumlis
Copy link
Author

plumlis commented Mar 29, 2022

I just following the Installation Instructions and everything works like a charm.

@minax007
Copy link

minax007 commented Mar 29, 2022

@palWorx

I can confirm the same.
In all previous gnome shell updates it was sufficient to adopt the metadata.json file and all worked fine.
Now with gnome shell 42 it all became a mess.
I have lost one of my most liked gnome shell extensions - and see that there is noone actively developing it any further.
But at least this one works now again.

@carlwgeorge
Copy link

I've updated the Fedora package to include the necessary patches. If any Fedora 36 early adopters would like to test it will be available as gnome-shell-extension-sound-output-device-chooser-40^2.4a6f0f2-2.fc36, which is on it's way to the updates-testing repository.

@bellini666
Copy link

New version works great! @kgshank can you upload the new version to extensions.gnome.org? I can see that the version there is even older than previous fixes in this repo

@vquemener
Copy link

@carlwgeorge I can confirm that the RPM gnome-shell-extension-sound-output-device-chooser-40^2.4a6f0f2-2.fc36.noarch from updates-testing works great on Fedora 36 👍

@kgshank
Copy link
Owner

kgshank commented Mar 31, 2022

The new version is uploaded into extensions.gnome.org and should be available after review

@pabs3
Copy link

pabs3 commented Apr 5, 2022

You might want to make a GitHub release for GNOME shell 42, so that downstream distros like Fedora or Debian can package it.

https://github.com/kgshank/gse-sound-output-device-chooser/releases

FYI gnome-shell 42 has reached Debian bookworm and gnome-shell-extension-sound-device-chooser has been removed.

https://bugs.debian.org/1008556

@francoism90
Copy link

@kgshank Asking the same for Arch Linux (AUR). :)

@kgshank
Copy link
Owner

kgshank commented Apr 8, 2022

@pabs3 & @francoism90 I missed to make a release this time. New releases are available now.

@kgshank
Copy link
Owner

kgshank commented Apr 12, 2022

Hi Everyone, the latest git version has some changes for Gnome V3.32. Since it affects the changes made for v42, is it possible for some of you to test the git version in V40/V42 and let me know whether all works good.

@thesmallcreeper
Copy link
Contributor

@kgshank Did you test at Gnome 3.32?

@kgshank
Copy link
Owner

kgshank commented Apr 13, 2022

@thesmallcreeper Yes I tested basic functionality to switch devices in Rocky Linux and @SonGokussj4 confirmed in #234
I haven't tried all the extension options rigorously though.

@SonGokussj4
Copy link

It works well from the last update. After PC restart, I've noticed a warning in /var/log/messages

sudo cat /var/log/messages | grep sound-output-device-chooser
Apr 13 17:29:47 tacticus journal[3205]: JS WARNING: [/home/jverner/.local/share/gnome-shell/extensions/[email protected]/extension.js 230]: reference to undefined property "_ornamentLabel"
Apr 13 17:29:47 tacticus journal[3205]: Extension "[email protected]" had error: TypeError: sliderItem._ornamentLabel is undefined
Apr 13 17:29:49 tacticus journal[3205]: JS WARNING: [/home/jverner/.local/share/gnome-shell/extensions/[email protected]/convenience.js 72]: reference to undefined property "id"

But, once again, it does appear to work without a problem for now :-)

@carlwgeorge
Copy link

Hi Everyone, the latest git version has some changes for Gnome V3.32. Since it affects the changes made for v42, is it possible for some of you to test the git version in V40/V42 and let me know whether all works good.

I tested f92fcbf on Fedora 36 Beta with GNOME Shell 42.0. As far as I can tell it works.

@kgshank
Copy link
Owner

kgshank commented Apr 22, 2022

@SonGokussj4 There are updates for the message you got,please check

@sa-bre
Copy link

sa-bre commented May 18, 2022

In case anyone has the same problem: After updating to Fedora 36 for whatever reason gnome extensions were disabled all together. Opening the Extensions application and switching the toggle in the top bar did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests