git.iko.soy/typeable/nixpkgs
on master help sign in
ibus-engines.typing-booster: init at 2.1.1

This package providesa completion input method for faster typing. See https://mike-fabian.github.io/ibus-typing-booster Detailed instructions how to activate this IBus engine on your desktop can be found in the upstream docs: https://mike-fabian.github.io/ibus-typing-booster/documentation.html A simple VM with the Gnome3 desktop and activated `ibus' looks like this: ```nix { emojipicker = { pkgs, ... }: { services.xserver = { enable = true; desktopManager.gnome3.enable = true; desktopManager.xterm.enable = false; }; users.extraUsers.vm = { password = "vm"; isNormalUser = true; }; i18n.inputMethod.ibus.engines = [ pkgs.ibus-engines.typing-booster ]; i18n.inputMethod.enabled = "ibus"; virtualisation.memorySize = 2048; }; } ``` Fixes #38721

commitdee2dab7c6a84c7615e81d20aec5e12ed3b0ae1b authorMaximilian Bosch <maximilian@mbosch.me> dateSun 16 Sep 2018, 18:36 (8 years ago) parentd3d465e
5 files changed+168
doc/package-notes.xml+60 pkgs/tools/inputmethods/ibus-engines/ibus-typing-booster/default.nix+41 pkgs/tools/inputmethods/ibus-engines/ibus-typing-booster/hunspell-dirs.patch+31 pkgs/tools/inputmethods/ibus-engines/ibus-typing-booster/wrapper.nix+30 pkgs/top-level/all-packages.nix+6
doc/package-notes.xml+60
@@ -814,4 +814,64 @@ citrix_receiver.override {
814814 </para>
815815 </section>
816816 </section>
817+ <section xml:id="sec-ibus-typing-booster">
818+ <title>ibus-engines.typing-booster</title>
819+
820+ <para>This package is an ibus-based completion method to speed up typing.</para>
821+
822+ <section xml:id="sec-ibus-typing-booster-activate">
823+ <title>Activating the engine</title>
824+
825+ <para>
826+ IBus needs to be configured accordingly to activate <literal>typing-booster</literal>. The configuration
827+ depends on the desktop manager in use. For detailed instructions, please refer to the
828+ <link xlink:href="https://mike-fabian.github.io/ibus-typing-booster/documentation.html">upstream docs</link>.
829+ </para>
830+ <para>
831+ On NixOS you need to explicitly enable <literal>ibus</literal> with given engines
832+ before customizing your desktop to use <literal>typing-booster</literal>. This can be achieved
833+ using the <literal>ibus</literal> module:
834+<programlisting>{ pkgs, ... }: {
835+ i18n.inputMethod = {
836+ enabled = "ibus";
837+ ibus.engines = with pkgs.ibus-engines; [ typing-booster ];
838+ };
839+}</programlisting>
840+ </para>
841+ </section>
842+
843+ <section xml:id="sec-ibus-typing-booster-customize-hunspell">
844+ <title>Using custom hunspell dictionaries</title>
845+
846+ <para>
847+ The IBus engine is based on <literal>hunspell</literal> to support completion in many languages.
848+ By default the dictionaries <literal>de-de</literal>, <literal>en-us</literal>, <literal>es-es</literal>,
849+ <literal>it-it</literal>, <literal>sv-se</literal> and <literal>sv-fi</literal>
850+ are in use. To add another dictionary, the package can be overridden like this:
851+<programlisting>ibus-engines.typing-booster.override {
852+ langs = [ "de-at" "en-gb" ];
853+}</programlisting>
854+ </para>
855+ <para>
856+ <emphasis>Note: each language passed to <literal>langs</literal> must be an attribute name in
857+ <literal>pkgs.hunspellDicts</literal>.</emphasis>
858+ </para>
859+ </section>
860+
861+ <section xml:id="sec-ibus-typing-booster-emoji-picker">
862+ <title>Built-in emoji picker</title>
863+
864+ <para>
865+ The <literal>ibus-engines.typing-booster</literal> package contains a program
866+ named <literal>emoji-picker</literal>. To display all emojis correctly,
867+ a special font such as <literal>noto-fonts-emoji</literal> is needed:
868+ </para>
869+ <para>
870+ On NixOS it can be installed using the following expression:
871+<programlisting>{ pkgs, ... }: {
872+ fonts.fonts = with pkgs; [ noto-fonts-emoji ];
873+}</programlisting>
874+ </para>
875+ </section>
876+ </section>
817877</chapter>
pkgs/tools/inputmethods/ibus-engines/ibus-typing-booster/default.nixnew file+41
@@ -0,0 +1,41 @@
1+{ stdenv, fetchFromGitHub, autoreconfHook, python3, ibus, pkgconfig, gtk3, m17n_lib
2+, wrapGAppsHook, gobjectIntrospection
3+}:
4+
5+let
6+
7+ python = python3.withPackages (ps: with ps; [
8+ pygobject3
9+ dbus-python
10+ ]);
11+
12+in
13+
14+stdenv.mkDerivation rec {
15+ name = "ibus-typing-booster-${version}";
16+ version = "2.1.1";
17+
18+ src = fetchFromGitHub {
19+ owner = "mike-fabian";
20+ repo = "ibus-typing-booster";
21+ rev = version;
22+ sha256 = "01kpxplk9nh56f32fkq3nnsqykbzpi7pcxbfp38dq0prgrhw9a6b";
23+ };
24+
25+ patches = [ ./hunspell-dirs.patch ];
26+
27+ nativeBuildInputs = [ autoreconfHook pkgconfig wrapGAppsHook gobjectIntrospection ];
28+ buildInputs = [ python ibus gtk3 m17n_lib ];
29+
30+ preFixup = ''
31+ gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "${m17n_lib}/lib")
32+ '';
33+
34+ meta = with stdenv.lib; {
35+ homepage = https://mike-fabian.github.io/ibus-typing-booster/;
36+ license = licenses.gpl3Plus;
37+ description = "A typing booster engine for the IBus platform";
38+ maintainers = with maintainers; [ ma27 ];
39+ isIbusEngine = true;
40+ };
41+}
pkgs/tools/inputmethods/ibus-engines/ibus-typing-booster/hunspell-dirs.patchnew file+31
@@ -0,0 +1,31 @@
1+diff --git a/engine/itb_util.py b/engine/itb_util.py
2+index ded236a..633525a 100755
3+--- a/engine/itb_util.py
4++++ b/engine/itb_util.py
5+@@ -1876,14 +1876,18 @@ def find_hunspell_dictionary(language):
6+ If no dictionary can be found for the requested language,
7+ the return value is ('', '').
8+ '''
9+- dirnames = [
10+- '/usr/share/hunspell',
11+- '/usr/share/myspell',
12+- '/usr/share/myspell/dicts',
13+- '/usr/local/share/hunspell', # On FreeBSD the dictionaries are here
14+- '/usr/local/share/myspell',
15+- '/usr/local/share/myspell/dicts',
16+- ]
17++
18++ if "NIX_HUNSPELL_DIRS" in os.environ:
19++ dirnames = os.environ["NIX_HUNSPELL_DIRS"].split(":")
20++ else: # fallback to the original behavior
21++ dirnames = [
22++ '/usr/share/hunspell',
23++ '/usr/share/myspell',
24++ '/usr/share/myspell/dicts',
25++ '/usr/local/share/hunspell', # On FreeBSD the dictionaries are here
26++ '/usr/local/share/myspell',
27++ '/usr/local/share/myspell/dicts',
28++ ]
29+ dic_path = ''
30+ aff_path = ''
31+ for language in expand_languages([language]):
pkgs/tools/inputmethods/ibus-engines/ibus-typing-booster/wrapper.nixnew file+30
@@ -0,0 +1,30 @@
1+{ typing-booster, symlinkJoin, hunspellDicts, lib, makeWrapper
2+, langs ? [ "de-de" "en-us" "es-es" "it-it" "sv-se" "sv-fi" ]
3+}:
4+
5+let
6+
7+ hunspellDirs = with lib; makeSearchPath ":" (flatten (flip map langs (lang: [
8+ "${hunspellDicts.${lang}}/share/hunspell"
9+ "${hunspellDicts.${lang}}/share/myspell"
10+ "${hunspellDicts.${lang}}/share/myspell/dicts"
11+ ])));
12+
13+in
14+
15+symlinkJoin {
16+ name = "${typing-booster.name}-with-hunspell";
17+ paths = [ typing-booster ];
18+ nativeBuildInputs = [ makeWrapper ];
19+
20+ postBuild = ''
21+ for i in bin/emoji-picker libexec/ibus-{setup,engine}-typing-booster; do
22+ wrapProgram "$out/$i" \
23+ --prefix NIX_HUNSPELL_DIRS : ${hunspellDirs}
24+ done
25+
26+ sed -i -e "s,${typing-booster},$out," $out/share/ibus/component/typing-booster.xml
27+ '';
28+
29+ inherit (typing-booster) meta;
30+}
pkgs/top-level/all-packages.nix+6
@@ -1906,6 +1906,12 @@ with pkgs;
19061906 };
19071907
19081908 uniemoji = callPackage ../tools/inputmethods/ibus-engines/ibus-uniemoji { };
1909+
1910+ typing-booster-unwrapped = callPackage ../tools/inputmethods/ibus-engines/ibus-typing-booster { };
1911+
1912+ typing-booster = callPackage ../tools/inputmethods/ibus-engines/ibus-typing-booster/wrapper.nix {
1913+ typing-booster = ibus-engines.typing-booster-unwrapped;
1914+ };
19091915 };
19101916
19111917 ibus-with-plugins = callPackage ../tools/inputmethods/ibus/wrapper.nix {