mzur / gnome-shell-wsmatrix

GNOME shell extension to arrange workspaces in a two-dimensional grid with workspace thumbnails
GNU General Public License v3.0
458 stars 58 forks source link

GNOME 42 and GJS >= 1.71 support #212

Closed matttbe closed 2 years ago

matttbe commented 2 years ago

Hello,

Recently, I installed an update of 'gjs' (Ubuntu Jammy 22.04) which seems causing issue with this nice WSMatrix extension!

Here are the logs from journalctl /usr/bin/gnome-shell

gnome-shell[2609]: Some code accessed the property 'WORKSPACE_SPACING' on the module 'workspaceAnimation'. That property was defined with 'let' or 'const' inside the module. This was previously supported, but is not correct according to the ES6 standard. Any symbols to be exported from a module must be defined with 'var'. The property access will work as previously for the time being, but please fix your code anyway.
gnome-shell[2609]: Some code accessed the property 'MonitorGroup' on the module 'workspaceAnimation'. That property was defined with 'let' or 'const' inside the module. This was previously supported, but is not correct according to the ES6 standard. Any symbols to be exported from a module must be defined with 'var'. The property access will work as previously for the time being, but please fix your code anyway.
gnome-shell[2609]: JS ERROR: Extension wsmatrix@martin.zurowietz.de: TypeError: class heritage GWorkspaceAnimation.MonitorGroup is not an object or null
   @~/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceAnimation.js:9:1
   @~/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js:2:28
   @~/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/extension.js:3:34
   _callExtensionInit@resource:///org/gnome/shell/ui/extensionSystem.js:426:13
   loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:347:27
   _loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:596:18
   collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:28
   _loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:571:19
   _enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:605:18
   _sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:636:18
   init@resource:///org/gnome/shell/ui/extensionSystem.js:56:14
   _initializeUI@resource:///org/gnome/shell/ui/main.js:268:22
   start@resource:///org/gnome/shell/ui/main.js:165:5
   @resource:///org/gnome/shell/ui/init.js:6:17

I suspect gjs because gnome-shell has not been updated recently: from 1.70.1 to 1.71.90. Not sure what else could cause that.

matttbe commented 2 years ago

Downgrading gjs to version 1.70.1 fixes this issue on my side.

Please note that with GJS 1.71.1, I have the same issue as with 1.71.90.

ebeem commented 2 years ago

I am using arch and my gjs's version is 1.70.1 So I am not sure if gjs version 1.71 was officially released. You're using a beta version of Ubuntu which might include packages in beta or alpha. So let's keep this open but take a look at it when gjs-1.71 is officially released.

mzur commented 2 years ago

FWIW I'll probably upgrade once Ubuntu 22.04 is released, so maybe I'll get a little more active here to scratch my own itches :smile:

matttbe commented 2 years ago

Thank you both for your replies!

GJS 1.71.1 has been released 3 weeks ago but it is a major release from what I see:

  • New JavaScript features! This version of GJS is based on SpiderMonkey 91, an upgrade from the previous ESR (Extended Support Release) of SpiderMonkey 78.

https://gitlab.gnome.org/GNOME/gjs/-/tags

That's maybe the reason why it has been delayed in Arch

zweif commented 2 years ago

I kind of got this working in Ubuntu 22.04, but I had to modify package gnome-shell. There are still errors I am unable to resolve because I'm unfamiliar with this stuff.

I could resolve the mentioned error by exporting MonitorGroup in gnome-shell (file js/ui/workspaceAnimation.js). It seemed I also needed to do this for https://github.com/mzur/gnome-shell-wsmatrix/blob/2afeac4b8d3bdec5e1aad9861c0a64c35a0ce9f2/wsmatrix%40martin.zurowietz.de/workspacePopup/workspaceAnimation.js#L135 and changed it to var WorkspaceAnimationController = class extends GWorkspaceAnimation.WorkspaceAnimationController {

At this point the extension is at least usable. Below are the errors I encountered:

The grid isn't shown in overview and I get the following error: JS ERROR: Extension wsmatrix@martin.zurowietz.de: TypeError: GObject_Object.prototype.[__GObject__hook_up_vfunc] called on incompatible Object hookVfunc@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/util.js:7:35 overrideProto@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/util.js:29:26 overrideOriginalProperties@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/overview/thumbnailsBox.js:300:43 override@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/overview/overviewManager.js:42:37 _handleShowOverviewGridChanged@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/overview/overviewManager.js:35:18 OverviewManager@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/overview/overviewManager.js:17:14 enable@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/extension.js:11:33 _callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:182:32 loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:364:26 _loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:620:18 collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:28 _loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:595:19 _enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:626:18 _sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:646:14 init@resource:///org/gnome/shell/ui/extensionSystem.js:56:14 _initializeUI@resource:///org/gnome/shell/ui/main.js:293:22 start@resource:///org/gnome/shell/ui/main.js:170:5 @resource:///org/gnome/shell/ui/init.js:6:17

When disabling grid in overview I get this error: JS ERROR: Extension wsmatrix@martin.zurowietz.de: TypeError: GWorkspacesView.SecondaryMonitorDisplay is undefined restoreOriginalProperties@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/overview/secondaryMonitorDisplay.js:49:9 restore@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/overview/overviewManager.js:52:47 _handleShowOverviewGridChanged@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/overview/overviewManager.js:37:18 OverviewManager@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/overview/overviewManager.js:17:14 enable@/home/[user]/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/extension.js:11:33 _callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:182:32 loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:364:26 _loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:620:18 collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:28 _loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:595:19 _enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:626:18 _sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:646:14 init@resource:///org/gnome/shell/ui/extensionSystem.js:56:14 _initializeUI@resource:///org/gnome/shell/ui/main.js:293:22 start@resource:///org/gnome/shell/ui/main.js:170:5 @resource:///org/gnome/shell/ui/init.js:6:17

I tried to export SecondaryMonitorDisplay in gnome-shell (file js/ui/workspacesView.js), but this did't seem to have any effect.

tjaalton commented 2 years ago

FWIW I'll probably upgrade once Ubuntu 22.04 is released, so maybe I'll get a little more active here to scratch my own itches smile

Did you mean that you'll look into this after 22.04 is released? I'd hope you as upstream to be more active maintaining your software, since some of us don't have the luxury of not running devel series we work on ;)

mzur commented 2 years ago

Did you mean that you'll look into this after 22.04 is released?

Yes, although I probably won't upgrade right away.

I'd hope you as upstream to be more active maintaining your software [...]

If you want more active development, you are welcome to help out. Some of us don't have the luxury to have too much spare time for hobby projects like these (which I originally developed only for my own needs) :wink:

ebeem commented 2 years ago

This is very bad, it seems like we can't extend classes defined with const. The warning That property was defined with 'let' or 'const' inside the module. This was previously supported, but is not correct according to the ES6 standard. Any symbols to be exported from a module must be defined with 'var'. The property access will work as previously for the time being, but please fix your code anyway. is not a warning anymore, and properties can't be accessed for extending.

The only option I have in mind is to completely copy the classes we need (no extending), this seems to be something to fix in upstream.

zweif commented 2 years ago

They had this merge request, so it should be possible to get access to the required classes. The question is if and when these changes will be picked up downstream.

Edit: Of course we* have to file a new merge request.

*someone who knows what is needed

ebeem commented 2 years ago

Thanks @zweif, I think we still can replace the functions in the classes (not inherit the class, but replace the prototype itself). I don't like this approach because it's more of a hack, extending is much cleaner. This update is so disappointing though, gjs-1.71 is causing a lot of issues, we still haven't looked at changes in gnome-42 😞

ettavolt commented 2 years ago

We can neither extend a class nor override its prototype simply because what's let or const is not accessible (i.e. accessing returns null). I've copied relevant parts of MonitorGroup (we can ask to open, according to zweif findings) and now I'm fighting vfunc overrides of ThumbnailsBox. While it is var, it is used in several places, and overriding all those is harder than monkey-patching ThumbnailsBox. Maybe that's the only way.

icegood commented 2 years ago

hello. When the release with the given changes will be planned? In the very nearest future many users will upgrade to ubuntu 22.04 with gnome 42 inside....

mzur commented 2 years ago

I may be able to review the PR in the next couple of days. But from what I read, there are still some issues and it requires manual patching of GNOME.

icegood commented 2 years ago

yes, there are still issues. if you need additional testing, you may rely on me

terentev commented 2 years ago

ubuntu 22.04 gnome 42

Apr 22 06:48:14 evg gnome-shell[3319]: Some code accessed the property 'WORKSPACE_SPACING' on the module 'workspaceAnimation'. That property was d>
Apr 22 06:48:14 evg gnome-shell[3319]: Some code accessed the property 'MonitorGroup' on the module 'workspaceAnimation'. That property was define>
Apr 22 06:48:14 evg gnome-shell[3319]: JS ERROR: Extension wsmatrix@martin.zurowietz.de: TypeError: class heritage GWorkspaceAnimation.MonitorGrou>
                                       @/home/evg/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceAnimati>
                                       @/home/evg/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManager>
                                       @/home/evg/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/extension.js:3:34
                                       _callExtensionInit@resource:///org/gnome/shell/ui/extensionSystem.js:440:13
                                       _callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:160:18
                                       _onEnabledExtensionsChanged/<@resource:///org/gnome/shell/ui/extensionSystem.js:512:35
                                       _onEnabledExtensionsChanged@resource:///org/gnome/shell/ui/extensionSystem.js:512:14
                                       createCheckedMethod/<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:533:46
                                       enableExtension@resource:///org/gnome/shell/ui/extensionSystem.js:209:29
                                       EnableExtension@resource:///org/gnome/shell/ui/shellDBus.js:448: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
mzur commented 2 years ago

@terentev Please update to the most recent development version of #217.

terentev commented 2 years ago

@terentev Please update to the most recent development version of #217.

good version of 217 work

but i have this problem 1) size small preview of workspaces 2) when clicking on workspaces that do not have open applications, switching does not occur 3) drag and drop applications works only on top 4 preview of workspaces

may be i need create a issue? Screenshot from 2022-04-22 20-08-53 Screenshot from 2022-04-22 20-20-24

mzur commented 2 years ago
  1. size small preview of workspaces

You mean in the overview? Otherwise you can configure the size in the extension settings.

  1. when clicking on workspaces that do not have open applications, switching does not occur

Could you please elaborate? I could not reproduce this issue in the overview (ignoring issue #177 there).

  1. drag and drop applications works only on top 4 preview of workspaces

This is a known issue since GNOME 40 (see #177).

terentev commented 2 years ago

1) how i can change size? i use (top left) activities button - workspaces small if i use (bottom left) Show Applications - size is ok

2) i use (top left) activities button - when clicking on workspaces that do not have open applications, switching does not occur if i use (bottom left) Show Applications - works

3) i use (top left) activities button - drag and drop applications works only on top 4 preview of workspaces if i use (bottom left) Show Applications - works

terentev commented 2 years ago

Could you please elaborate?

how?

mzur commented 2 years ago
  1. how i can change size?

The size in the activities overview or the applications menu cannot be adjusted. Could you please show a screenshot if you think the size is too small there? It looks like this for me:

image

  1. i use (top left) activities button - when clicking on workspaces that do not have open applications, switching does not occur

Have you checked this for empty workspaces in the top row as well? The bottom rows don't work either for switching or for drag and drop (see #177).