IBus: Difference between revisions

Jasi (talk | contribs)
Installation: Remove unnecessary snippet about rebuilding the system.
Jasi (talk | contribs)
m Installation: Format code block (using nixfmt-rfc-style)
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:


== 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]. To enable it is as follows:
Mainly, it can be done as follows:


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|3={ pkgs, lib, ... }:
{pkgs, lib, ...}:
{
{
i18n.inputMethod = {
  i18n.inputMethod = {
  enable = true;
    enable = true;
  type = "ibus";
    type = "ibus";
  ibus.engines = with pkgs.ibus-engines; [ /* any engine you want, for example */ anthy ];
    ibus.engines = with pkgs.ibus-engines; [
};
      # Your engines here
}
    ];
</nowiki>}}After rebuilding and switching to the new configuration, you still need to logout from your session and login again for ibus to work correctly.
  };
}|name=/etc/nixos/configuration.nix|lang=nix}}Available engines are listed under the <code>pkgs.ibus-engines</code> attribute set. The list of available engines can be viewed in the documentation for the {{nixos:option|i18n.inputMethod.ibus.engines}}option.


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


To get the list of available engines, you can use the tab completion of <code>nix repl</code>.
== Troubleshooting ==
<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}}.


=== Custom emojis ===
=== 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]] snippet.
{{file|~/.config/nixpkgs/home.nix|nix|<nowiki>
{{file|3={ pkgs, lib, config, ... }:
{ pkgs, lib, config, ... }:
let
let
   /* define here the list of desired favorite emoji */
   /* define here the list of desired favorite emoji */
Line 43: Line 35:
     favorites = mkArray type.string (lib.attrValues fav);
     favorites = mkArray type.string (lib.attrValues fav);
   };
   };
}
}|name=~/.config/home-manager/home.nix|lang=nix}}
</nowiki>}}
 


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


== See also ==
== See also ==