Skip to content

Instantly share code, notes, and snippets.

@supershadoe
Last active August 1, 2022 12:02
Show Gist options
  • Save supershadoe/441d0ef75c8ba80a37ba0ca2a091fbd0 to your computer and use it in GitHub Desktop.
Save supershadoe/441d0ef75c8ba80a37ba0ca2a091fbd0 to your computer and use it in GitHub Desktop.
ibus-mozc with gtk2 instead of qt

ibus-mozc-gtk

About

A gist to patch the default ibus-mozc AUR package to build with GTK 2 instead of QT. Using QT_QPA_PLATFORM=wayland makes mozc suggestions window be placed in some random place and using xwayland for mozc doesn't feel right with the dull light theme and faint letters.

I learnt by surfing through GitHub issue tracker of google/mozc that you can build for GTK2 and thus, made this patch. As for why not an actual AUR package, mozc apparantly is going to drop support for GTK 2 and would use QT only in the near future. So, for the small time that it's going to support GTK2, it doesn't make sense to create a package.

How to use

If you use the Arch Build System (no AUR helpers),

Use this diff by using git apply PKGBUILD.diff in the cloned git folder of ibus-mozc package from AUR and then use makepkg -si.

If you use paru, you would need to clear cache for ibus-mozc (probably located in ~/.cache/paru/clone/ibus-mozc) and then se paru --fm=vim ibus-mozc and enter :shell in vim and then run the following commands,

cd ibus-mozc
git apply path_to_diff
exit

Then exit vim with :q (Now you know how to exit vim 🙃)

paru rebases the build() and package() but throws a rebase/merge conflict (if you commit the changes) for prepare() and depends=. So, it is better to just clear cache than deal with it.

Note: Using vim here because

  • using a direct shell as file manager in paru didn't work well
  • using a GUI file manager like nautilus is not intuitive (needs you to kill nautilus using nautilus -q and stuff)
  • I don't use TUI file managers
diff --git a/PKGBUILD b/PKGBUILD
index b5a7e6e..27ccef5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -11,7 +11,7 @@ arch=('x86_64')
url='https://github.com/google/mozc'
license=('Apache' 'BSD' 'LGPL' 'custom')
depends=('ibus>=1.4.1' 'mozc>=2.28.4800.102')
-makedepends=('bazel' 'git' 'python' 'qt5-base')
+makedepends=('bazel' 'git' 'python' 'gtk2')
options=(!distcc !ccache)
source=("${pkgname}-git::git+https://github.com/google/mozc.git#commit=9dc923ab84f4f0369ba507848430c0bd42dbd01d")
sha256sums=('SKIP')
@@ -26,7 +26,7 @@ build() {
cd ${pkgname}-git/src
export JAVA_HOME='/usr/lib/jvm/java-11-openjdk/'
- bazel build renderer:mozc_renderer unix/ibus:ibus_mozc unix/icons --config oss_linux --compilation_mode opt
+ bazel build renderer:gtk_mozc_renderer unix/ibus:ibus_mozc unix/icons --config oss_linux --compilation_mode opt
}
package() {
@@ -35,7 +35,7 @@ package() {
install -Dm644 ../LICENSE ${pkgdir}/usr/share/licenses/ibus-mozc/LICENSE
install -Dm644 data/installer/credits_en.html ${pkgdir}/usr/share/licenses/ibus-mozc/credits_en.html
- install -Dm755 bazel-bin/renderer/mozc_renderer ${pkgdir}/usr/lib/mozc/mozc_renderer
+ install -Dm755 bazel-bin/renderer/gtk_mozc_renderer ${pkgdir}/usr/lib/mozc/gtk_mozc_renderer
install -Dm755 bazel-bin/unix/ibus/ibus_mozc ${pkgdir}/usr/lib/ibus-mozc/ibus-engine-mozc
install -Dm644 bazel-bin/unix/ibus/mozc.xml ${pkgdir}/usr/share/ibus/component/mozc.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment