From f88dbc2108b2888b2afb5d45cdfddecd9436331c Mon Sep 17 00:00:00 2001 From: Andrew Voynov Date: Mon, 24 Feb 2025 09:09:12 +0300 Subject: [PATCH] i18n.inputMethod.ibus: add waylandFrontend option With this option GTK_IM_MODULE and QT_IM_MODULE env vars are not set. This is recommended by some popular Linux distributions. For instance, this will move IME candidate pane next to input field instead of on top of it in Firefox on GNOME, so you can see what you type. --- nixos/modules/i18n/input-method/ibus.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix index aec11b2362fc..4d5535d63e3e 100644 --- a/nixos/modules/i18n/input-method/ibus.nix +++ b/nixos/modules/i18n/input-method/ibus.nix @@ -56,6 +56,15 @@ in example = lib.literalExpression ''"''${pkgs.kdePackages.plasma-desktop}/libexec/kimpanel-ibus-panel"''; description = "Replace the IBus panel with another panel."; }; + waylandFrontend = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Use the Wayland input method frontend. + This doesn't set `GTK_IM_MODULE` and `QT_IM_MODULE` environment variables. + See [Using Fcitx 5 on Wayland](https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland#GTK_IM_MODULE). + ''; + }; }; }; @@ -76,9 +85,11 @@ in ]; environment.variables = { + XMODIFIERS = "@im=ibus"; + } + // lib.optionalAttrs (!cfg.waylandFrontend) { GTK_IM_MODULE = "ibus"; QT_IM_MODULE = "ibus"; - XMODIFIERS = "@im=ibus"; }; xdg.portal.extraPortals = lib.mkIf config.xdg.portal.enable [