gnome-shell-extensions-negesti icon indicating copy to clipboard operation
gnome-shell-extensions-negesti copied to clipboard

Settings dialogue doesn't work on gtk4 / Gnome 40

Open EdAyers opened this issue 3 years ago • 15 comments

This issue stems from #190

Gnome version: 40.0.0 Windowing system: X11 OS: Arch Linux, rolling

There is a problem, the extension itself is working for me but I've discovered the settings dialogue doesn't work

Screenshot from 2021-04-09 11-49-55

Error: Requiring Wnck, version none: Requiring namespace 'Gtk' version '3.0', but '4.0' is already loaded

Stack trace:
  @/home/edward/.local/share/gnome-shell/extensions/[email protected]/prefs.js:5:14
  _init@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:206:33
  OpenExtensionPrefsAsync/<@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:122:28
  asyncCallback@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:115:22
  run@resource:///org/gnome/Shell/Extensions/js/dbusService.js:177:20
  main@resource:///org/gnome/Shell/Extensions/js/main.js:19:13
  run@resource:///org/gnome/gjs/modules/script/package.js:206:19
  start@resource:///org/gnome/gjs/modules/script/package.js:190:8
  @/usr/share/gnome-shell/org.gnome.Shell.Extensions:1:17

This seems to have come up at #170

But I have installed libwnck3, so I'm not sure what to do.

@negesti replied:

I guess libwnck3 will not work with gtk 4. As i'm on 3.38 i can not really test it, but maybe you can try the current develop version. It should at least not fail on startup

EdAyers avatar Apr 14 '21 11:04 EdAyers

It looks like GTK4 makes a lot of non-trivial breaking changes to the API. Sigh.

FWIW I had a quick go at fixing this (hoping it would just be about renaming a few things) but I ran out of steam because there are lots of issues and I am not familiar with GTK and I didn't have a good debug cycle set up. I'll put my post-mortem here in case someone else wants to pick this up.

Some resources which might help someone:

  • Migration guide is here: https://developer.gnome.org/gtk4/4.0/gtk-migrating-3-to-4.html
  • API reference https://gjs-docs.gnome.org/gtk40~4.0.3/
  • Another project that uses GTK4 javascript without any markup is the GNOME documents app: https://gitlab.gnome.org/GNOME/gnome-documents

Some specific API breaks for this project (non-exhaustive)

  • explicit styles on eg Gtk.Label has been removed, so all of the inline styles such as margin_left : "4px" need to be removed somehow.
  • scroll.add_with_viewport doesn't exist anymore. Instead I think it's set_child.
  • No property expand on GtkTreeView, instead it should be vexpand I think?
  • Toolbars have been deprecated, so the bits using toolbars have to be rewritten
  • Gtk.STYLE_CLASS_RAISED is gone. Change to "raised"?

EdAyers avatar May 15 '21 15:05 EdAyers

Another extension I use is having a similar crisis: https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet/issues/672 https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet/pull/678

EdAyers avatar May 15 '21 15:05 EdAyers

thanks for looking into this! i will check it once i got enough time to update to Fedora 34

negesti avatar May 17 '21 19:05 negesti

thanks for looking into this! i will check it once i got enough time to update to Fedora 34

You can use GNOME OS (Nightly) to start working on it at beta during code freeze: https://os.gnome.org/

Kerrung avatar May 25 '21 12:05 Kerrung

@Kerrung thanks for the hint, but that doesn't solve my time problem :)

negesti avatar May 25 '21 18:05 negesti

Thanks @negesti. This extension is indispensable. Getting it on GNOME 40 -- once you update to Fed 34 -- will be amazing. I have never built an extension, but would be honored to help in any way.

TheRoarkster avatar Jul 09 '21 21:07 TheRoarkster

@TheRoarkster The problem "only" affects the settings dialog. As gnome 40 now uses GTK 4 it looks like prefs.js needs a complete re-write :( Port Extensions to GNOME Shell 40

At leasting starting the settings do not require a complete gnome-shell restart (at least it didn't before v40)

gnome-shell-extension-prefs [email protected]

negesti avatar Jul 11 '21 07:07 negesti

I'm confused -- it doesn't work at all -- that is, it does not "put" any windows anywhere based on my prior settings -- on my instance of GNOME 40.3 in Manjaro or another instance running on Fedora 34.

I understand you don't have the time to fix -- just wondering if it is currently working (other than settings dialog) for you; that is, the extension loads and puts windows places.

FWIW, I tried launching the settings dialog using the code in your prior post. Here is the error I got:

Error: Requiring Wnck, version none: Requiring namespace 'Gtk' version '3.0', but '4.0' is already loaded

Stack trace:
  @/home/rsync/.local/share/gnome-shell/extensions/[email protected]/prefs.js:5:14
  _init@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:206:33
  OpenExtensionPrefsAsync/<@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:122:28
  asyncCallback@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:115:22
  run@resource:///org/gnome/Shell/Extensions/js/dbusService.js:177:20
  main@resource:///org/gnome/Shell/Extensions/js/main.js:19:13
  run@resource:///org/gnome/gjs/modules/script/package.js:206:19
  start@resource:///org/gnome/gjs/modules/script/package.js:190:8
  @/usr/share/gnome-shell/org.gnome.Shell.Extensions:1:17

TheRoarkster avatar Jul 15 '21 18:07 TheRoarkster

@TheRoarkster: I can confirm that after upgrading to GNOME Shell 40.3 on Manjaro the extension stopped working for me. Both the setting dialog and the extension itself stopped working.

Btw I only used the extension to shift focus between windows but I have been relying on the functionality heavily. I can't promise anything but I will try to look into making this part of the extension work.

curusarn avatar Aug 08 '21 21:08 curusarn

FWIW, GTK4 migration guide has moved from https://developer.gnome.org/gtk4/4.0/gtk-migrating-3-to-4.html to https://docs.gtk.org/gtk4/migrating-3to4.html

Until the port is implemented, settings can be edited with Dconf Editor:

dconf-editor  /org/gnome/shell/extensions/org-lab21-putwindow/

pdecat avatar Oct 12 '21 21:10 pdecat

FWIW, GTK4 migration guide has moved from https://developer.gnome.org/gtk4/4.0/gtk-migrating-3-to-4.html to https://docs.gtk.org/gtk4/migrating-3to4.html

Until the port is implemented, settings can be edited with Dconf Editor:

dconf-editor  /org/gnome/shell/extensions/org-lab21-putwindow/

It seems i cannot edit settings like that because entry doesn't exist on dconf-editor. Also the extension doesn't work at all. Ubuntu 21.10 GNOME 40.5 Manually copied the extension from git and activated through gnome extensions

Dolland avatar Dec 23 '21 22:12 Dolland

Settings can be opened again but I'm really stuck with GTK 4 and the application settings site. Additionally i remove styles/maring/padding as this was changed with 4.0 and the settings really look wired now :(

negesti avatar Jan 13 '22 18:01 negesti

Subscribing to this feed, I'm looking forward to the fix of this issue :)

Hideman85 avatar Feb 28 '22 18:02 Hideman85

Started with the cleanup of the old < 40 code. But the settings panel does really work :/

negesti avatar Jun 13 '22 19:06 negesti

Current documentation for Extension and migrations guide can be found here https://gjs.guide/extensions/upgrading/gnome-shell-40.html#gtk-accelerator-parse

negesti avatar Jun 30 '22 16:06 negesti