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

Update for gnome shell 42 #9

Merged
merged 5 commits into from
Jul 19, 2024
Merged

Conversation

lumbric
Copy link
Contributor

@lumbric lumbric commented Jul 4, 2024

This is a quick draft to make things compatible with gnome shell 42.9.

Note that this is my first time touching gnome extensions and I have very limited know how - please use this PR with caution.

I simply debugged the thing until it was working with my version of GNOME Shell. No idea which versions are actually compatible. But you can easily modify the metadata.json and add other GNOME Shell versions and test it there.

$ gnome-shell --version
GNOME Shell 42.9

What I had to do to get it working again:

  • use the GObject.registerClass() function and use ES 6 class instead of an object for the indicator. I'm not entirely sure why this is necessary, I basically guessed it from the error message and a comparison to a working extension which I created from a template using the gnome-extensions-tool by running gnome-extensions create --interactive and choosing "indicator" as template. There are also some hints regarding migrating shell classes here.
  • I had to declare all variables. No idea why. I just put a let wherever necessary.
  • I had to adapt the prefs.xml: I simply followed the error messages and got some inspiration by running gtk4-builder-tool simplify --3to4 prefs.xml - but the automatically converted xml did not show any dialog - just the empty window. Basically margin and GtkVBox has been removed as far as I understand.

Thanks to @petres for the help! 💜

This may fix #7.

Seems to be mandatory now.
This was done just by guessing: I removed manually everything which
seemed to cause an error. It works now, but it looks a bit ugly.
This makes things a bit more beautiful again.
This is extremely strict, I have no idea which gnome shell versions are
supported and which are not.
@lumbric lumbric mentioned this pull request Jul 4, 2024
@lumbric
Copy link
Contributor Author

lumbric commented Jul 4, 2024

Others might find this PR when porting a GNOME Shell extension and googling for the error messages, so let's put the error messages here and some quick hints what helped me getting this extension running again:

(See commits for this PR for details.)

Error 1

Object 0xb70d1a269e8 is not a subclass of GObject_Object, it's a Object

Resolution: convert to ES6 classes and use `GObject.registerClass()?

Error 2

assignment to undeclared variable SOME_VARIABLE_NAME

Resolution: use letto declare all variables.

Error 3

Gtk.BuilderError: /home/my_user./local/share/gnome-shell/extensions/[email protected]/prefs.xml:38:29 Invalid property: GtkGrid.margin

Resolution: simply remove this property from the xml. Seems to look good enough.

Error 4

Gtk.BuilderError: /home/peter/.local/share/gnome-shell/extensions/[email protected]/prefs.xml:44:1 Invalid object type 'GtkVBox'

Resolution: Change GtkVBox to GtkBox in the prefs.xml. Then child objects are not aligned vertically, so you probably want to add <property name="orientation">vertical</property> (this is what the gtk4-builder-tool suggested and it seems to work fine).

Error 5

TypeError: box.show_all is not a function

Resolution: Simply remove the line box.show_all();, returning the object seems to be fine. I've been inspired by phocean/TopIcons-plus#156 and UshakovVasilii/gnome-shell-extension-freon#195.

@tassos
Copy link
Owner

tassos commented Jul 19, 2024

thanks for the effort @lumbric! Unfortunately I don't use gnome-shell anymore (or gnome for that matter), so I cannot really test this, but the changes seem to make sense so I will approve this anyway.

I am not maintaining this plugin anymore, so if you want I could transfer the ownership to you, or just continue working on your own fork (and I can archive this repo, and link to yours). The second option might be better so we don't end up with broken links. WDYT?

@tassos tassos merged commit c74fa50 into tassos:master Jul 19, 2024
@lumbric
Copy link
Contributor Author

lumbric commented Jul 19, 2024

@tassos thanks for the offer! I'm not sure if I can really take over maintainership at this point. I'll contact you again if I decide that I will continue working on the plugin.

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

Successfully merging this pull request may close these issues.

Doesnt work for 18.10
2 participants