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

Adding GTK4 IM modules to support IME frameworks in Wayland #106

Closed
tinywrkb opened this issue Dec 29, 2021 · 7 comments
Closed

Adding GTK4 IM modules to support IME frameworks in Wayland #106

tinywrkb opened this issue Dec 29, 2021 · 7 comments

Comments

@tinywrkb
Copy link

This should be fixed ​in the runtime, but a proof-of-concept, I created an extension that adds the IM modules to test this new feature.

You would need first to build and install the base app, as the extension need to be mounted somewhere during build time.
And then you can build the extension.
Only Fcitx5 modules were added. Maybe I'll try adding IBus later.

Changes needed to the app:

  • Create a mount point at /app/immodules
  • Set --env=GTK_PATH=/app/lib/gtkmodules:/app/immodules in the finish-args array
  • Add the extension
add-extensions:
  org.freedesktop.Platform.IMModules:
    directory: immodules
    version: '21.08'
    add-ld-path: lib
    no-autodownload: true
    autodelete: false

Chrome should be started with the flag --gtk-version=4

@refi64
Copy link
Collaborator

refi64 commented Dec 31, 2021

Is there a bug filed for the runtime to add this yet? I wouldn't mind adding it here if there's no plans to add it to 21.08 / has an undefined timeline, but if it's coming relatively SOON(tm) I don't want to end up with an accidentally slightly incompatible version or something.

@tinywrkb
Copy link
Author

tinywrkb commented Jan 1, 2022

No, I haven't reported it myself and didn't see a relevant bug report.

I wasn't sure if the devs would agree to add GTK4 and other libraries to the 21.08 runtime, and it already has libfcitx4 which conflicts with libfcitx5, or at least when using the buildsystem installation target (overwrites some .so symlinks). edit: I dropped libfcitx5, it's not needed for building the module
It's likely possible to add the GTK4 Fcitx5 IM module to the runtime and not affect the exiting GTK3 Fcitx4 module, but it's not the approach I would choose.

An extension that can be reused seems like a good temporary solution until the 22.08 runtime will be available.

I haven't looked at IBus yet, so I can't comment about it.

Anyway, I hoped to get here some feedback, and maybe move this extension solution forward.

Note the existing issues:

@tinywrkb
Copy link
Author

tinywrkb commented Jan 2, 2022

I added the GTK4 IBus IM module, and at first glance it works correctly, even though gio-querymodules doesn't add it to giomodule.cache.

Fcitx5 has a IBus backend, so it's possible to use the IBus IM module with the Fcitx5 daemon.
The reason one would want to do this is to take advantage of the working popups while still using Fcitx5.
edit: And this is exactly what I'm doing, as I'm running my own updated build of the Fcitx5 Flathub app, testing the ChineseAddons and Hangul extensions (the latter not on Flathub yet).

@tinywrkb
Copy link
Author

tinywrkb commented Jan 3, 2022

I looked at this again today, and confirmed that Chrome uses GTK4 at least also for the system printing popup window.
The GTK3 CUPS printing backend, and libcups are already bundle in this app and others (some Electron based), so the Flatpak extension approach might not be the best solution, even if makes it possible to avoid bundling GTK4 in every Chromium based app.

The handful Chromium based browsers and CEF based apps can build and package GTK4, the IM modules, and printing backends, if needed.
Electron based apps, if this framework supports GTK4, will be able to use GTK4 and its modules from the base app.

I updated the packaging, and now it's pretty minimal, building and installing just needed dependencies and features.

Other possible changes that can be made:

  • Enable the GTK4 CUPS backend. Especially if it's decided to go forward with bundling the IM modules in the Flatpak app here.
  • Don't build updated GTK3 IM modules.
  • Avoid installing ECM by building it with the Fcitx5 GTK4 modules. See example.

If it's decided to bundle GTK4 and the IM modules in the app, then I can send a PR.

@tinywrkb
Copy link
Author

tinywrkb commented Jan 3, 2022

I've been testing with Chrome dev builds, so I haven't noticed that we need to wait for Chrome 97, so a PR with my changes won't help much without switching release channel.

I sent a PR to the Edge app, and it's working there, as the Beta channel is on 97.

CUPS backend is also packaged now and working.

@tinywrkb
Copy link
Author

tinywrkb commented Jan 4, 2022

Oh! Stable due date is today. I'll send a PR.

@tinywrkb
Copy link
Author

Closing in favor of adding to Chromium base app.

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

No branches or pull requests

2 participants