Jump to content

IBus: Difference between revisions

From NixOS Wiki
Undo revision 17030, kept the changes for reference on older versions of Nix
Pigs (talk | contribs)
m Add category, fix formatting
Line 1: Line 1:
IBus is a bus for various input methods.
[https://en.wikipedia.org/wiki/Intelligent_Input_Bus IBus] is a bus for various input methods.


=== Installation ===
== Installation ==
Enabling IBus is described in the [https://nixos.org/nixos/manual/index.html#module-services-input-methods-ibus manual].
Enabling IBus is described in the [https://nixos.org/nixos/manual/index.html#module-services-input-methods-ibus manual].
Mainly, it can be done as follows:
Mainly, it can be done as follows:
Line 19: Line 19:
After switching, you still need to logout from your session and login again for ibus to work correctly.
After switching, you still need to logout from your session and login again for ibus to work correctly.


For nix version older than 24.11, <code>enabled = "ibus";</code> is used instead of <code>enable</code> and <code>type</code>
{{note|For nix version older than 24.11, <code>enabled &equals; "ibus";</code> is used instead of <code>enable</code> and <code>type</code>}}
 
=== Input methods ===


==== Input methods ====
To get the list of available engines, you can use the tab completion of <code>nix repl</code>.
To get the list of available engines, you can use the tab completion of <code>nix repl</code>.
{{Commands|
<syntaxhighlight lang="console">
$ nix repl
$ nix repl
nix-repl> ibus-engines.<Tab>
nix-repl> ibus-engines.<Tab>
}}
</syntaxhighlight>


==== Custom emojis ====
The list of available engines are also at {{nixos:option|i18n.inputMethod.ibus.engines}}.
 
=== Custom emojis ===
Custom emojis can be added to the emoji selection dialog of IBus. This can be used to workaround the fact that GTK does not support compose rules which output more than one unicode codepoint. Here an example [[Home Manager]] module:
Custom emojis can be added to the emoji selection dialog of IBus. This can be used to workaround the fact that GTK does not support compose rules which output more than one unicode codepoint. Here an example [[Home Manager]] module:
{{file|~/.config/nixpkgs/home.nix|nix|<nowiki>
{{file|~/.config/nixpkgs/home.nix|nix|<nowiki>
Line 50: Line 53:


Then, typing <code>Ctrl+Shift+e</code> and then <code>shrug</code>, Space and Return will insert <code>¯\_(ツ)_/¯</code>.
Then, typing <code>Ctrl+Shift+e</code> and then <code>shrug</code>, Space and Return will insert <code>¯\_(ツ)_/¯</code>.
== See also ==
* [[Locales]]
[[Category:Configuration]]
[[Category:NixOS Manual]]

Revision as of 16:41, 18 May 2025

IBus is a bus for various input methods.

Installation

Enabling IBus is described in the manual. Mainly, it can be done as follows:

❄︎ /etc/nixos/configuration.nix
{pkgs, lib, ...}:
{
 i18n.inputMethod = {
  enable = true;
  type = "ibus";
  ibus.engines = with pkgs.ibus-engines; [ /* any engine you want, for example */ anthy ];
 };
}
🟆︎
Tip: In order to affect your NixOS system by your nix-language-specific changes you must first evaluate it:
$ nixos-rebuild switch --sudo

After switching, you still need to logout from your session and login again for ibus to work correctly.

Note: For nix version older than 24.11, enabled = "ibus"; is used instead of enable and type

Input methods

To get the list of available engines, you can use the tab completion of nix repl.

$ nix repl
nix-repl> ibus-engines.<Tab>

The list of available engines are also at i18n.inputMethod.ibus.engines.

Custom emojis

Custom emojis can be added to the emoji selection dialog of IBus. This can be used to workaround the fact that GTK does not support compose rules which output more than one unicode codepoint. Here an example Home Manager module:

❄︎ ~/.config/nixpkgs/home.nix
{ pkgs, lib, config, ... }:
let
  /* define here the list of desired favorite emoji */
  fav = {
    shrug = ''¯\_(ツ)_/¯'';
    "markdown-shrug" = ''¯\\\_(ツ)\_/¯'';
    flip = ''(╯°□°)╯︵ ┻━┻'';
  };
in
{
  dconf.settings."desktop/ibus/panel/emoji" = with lib.hm.gvariant; {
    favorite-annotations = mkArray type.string (lib.attrNames fav);
    favorites = mkArray type.string (lib.attrValues fav);
  };
}


Then, typing Ctrl+Shift+e and then shrug, Space and Return will insert ¯\_(ツ)_/¯.

See also