Jump to content

IBus: Difference between revisions

From NixOS Wiki
Jasi (talk | contribs)
Installation: Remove unnecessary snippet about rebuilding the system.
Jasi (talk | contribs)
Input methods: Remove snippet about nix-repl which lacks context for loading nixpkgs and is inferior to the second option of viewing the option docs.
Line 18: Line 18:
=== Input methods ===
=== Input methods ===


To get the list of available engines, you can use the tab completion of <code>nix repl</code>.
Available engines are listed under the `pkgs.ibus-engines` attribute set.  
<syntaxhighlight lang="console">
$ nix repl
nix-repl> ibus-engines.<Tab>
</syntaxhighlight>


The list of available engines are also at {{nixos:option|i18n.inputMethod.ibus.engines}}.
The list of available engines can be viewed in the documentation for the {{nixos:option|i18n.inputMethod.ibus.engines}}option.


=== Custom emojis ===
=== Custom emojis ===

Revision as of 00:42, 10 July 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 ];
 };
}

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

Input methods

Available engines are listed under the `pkgs.ibus-engines` attribute set.

The list of available engines can be viewed in the documentation for the i18n.inputMethod.ibus.enginesoption.

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