git.m455.casa

m455.casa

clone url: git://git.m455.casa/m455.casa


html/posts/setting-up-a-chinese-input-method-on-debian.html

1 <!DOCTYPE html>
2 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <meta name="generator" content="pandoc" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
7 <title>Setting up a Chinese input method on Debian</title>
8 <style>
9 code{white-space: pre-wrap;}
10 span.smallcaps{font-variant: small-caps;}
11 span.underline{text-decoration: underline;}
12 div.column{display: inline-block; vertical-align: top; width: 50%;}
13 div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
14 ul.task-list{list-style: none;}
15 </style>
16 <link rel="stylesheet" href="/assets/archive.css">
17 </head>
18 <body>
19 <main>
20 <h2 id="setting-up-a-chinese-input-method-on-debian">Setting up a Chinese input method on Debian</h2>
21 <p>2019-11-05 00:00</p>
22 <p>This guide will teach you how to setup a Chinese input method on Debian. It is intended for users who have basic graphical navigation and command-line skills in a Unix-like environment or a Debian-based Linux distribution.</p>
23 <p>This document consists of the following sections:</p>
24 <ul>
25 <li><a href="#conventions-used-in-this-guide">Conventions used in this guide</a></li>
26 <li><a href="#requirements">Requirements</a></li>
27 <li><a href="#downloading-the-fcitx-input-method-using-apt">Downloading the fcitx input method using apt</a></li>
28 <li><a href="#accessing-fcitxs-configuration-settings">Accessing fcitx’s configuration settings</a></li>
29 <li><a href="#finding-the-fcitx-sunpinyin-input-method">Finding the fcitx Sunpinyin input method</a></li>
30 <li><a href="#configuring-fcitx">Configuring fcitx</a></li>
31 <li><a href="#enabling-fcitx-at-startup">Enabling fcitx at startup</a></li>
32 <li><a href="#making-sure-fcitx-is-working-correctly">Making sure fcitx is working correctly</a></li>
33 </ul>
34 <h3 id="conventions-used-in-this-guide">Conventions used in this guide</h3>
35 <ul>
36 <li><strong>Note</strong>: Signifies additional information</li>
37 <li><strong>Tip</strong>: Signifies an alternative procedure for completing a step</li>
38 <li><strong>Warning</strong>: Signifies that damage, such as data loss, may occur</li>
39 <li><strong>Example</strong>: Shows how a procedure would be performed in a real scenario</li>
40 <li><code>Inline code and code blocks</code>: Signify package names, filenames, file contents, or commands</li>
41 <li><strong>Figure caption</strong> Signifies a description for a figure (an image)</li>
42 <li><code>&lt;variable&gt;</code> Signifies that the text between the <code>&lt;</code> and <code>&gt;</code> should be replaced, and the <code>&lt;</code> and <code>&gt;</code> should be removed</li>
43 <li><strong>Bold font</strong> Signifies user interface items</li>
44 </ul>
45 <h3 id="requirements">Requirements</h3>
46 <ul>
47 <li>A Debian-based Linux distribution</li>
48 <li>A package manager (in this guide, I use the <code>apt</code> package manager)</li>
49 </ul>
50 <h3 id="downloading-the-fcitx-input-method-using-apt">Downloading the fcitx input method using apt</h3>
51 <p>This section will guide you through downloading the <code>fcitx</code> package using the <code>apt</code> package manager. The <code>fcitx</code> package will allow you to type in Pinyin to produce Chinese characters.</p>
52 <h4 id="to-download-the-fcitx-package-using-apt">To download the fcitx package using apt</h4>
53 <ol type="1">
54 <li><p>Run the following command:</p>
55 <pre><code> sudo apt install fcitx fcitx-sunpinyin</code></pre></li>
56 <li><p>Confirm the installation by typing <code>y</code> when prompted</p></li>
57 </ol>
58 <h3 id="accessing-fcitxs-configuration-settings">Accessing fcitx’s configuration settings</h3>
59 <p>This section will help you access fcitx’s configuration settings, so you can then make using fcitx more convenient.</p>
60 <h4 id="to-access-fcitxs-configuration-settings">To access fcitx’s configuration settings</h4>
61 <ol type="1">
62 <li><p>Run <code>fcitx</code> on the command line to access fcitx’s configuration settings</p></li>
63 <li><p>Right-click the icon in your system tray</p>
64 <figure>
65 <img src="/assets/images/keyboard-icon.png" alt="" /><figcaption>The fcitx icon in the system tray</figcaption>
66 </figure></li>
67 <li><p>Click <strong>Configure</strong></p>
68 <figure>
69 <img src="/assets/images/click-configure.png" alt="" /><figcaption>The fcitx menu popping up after right-clicking the icon in the system tray</figcaption>
70 </figure></li>
71 </ol>
72 <aside class="border">
73 <p>
74 <strong>Tip</strong>: If your current input method does not show up in the fcitx configuration window, try to run <code>pkill fcitx</code> on the command line to kill the fcitx process, and then run <code>fcitx</code> to start the fcitx process again. If this still doesn’t work, try restarting your computer to ensure the <code>fcitx</code> and <code>fcitx-sunpinyin</code> packages have installed correctly.
75 </p>
76 </aside>
77 <h3 id="finding-the-fcitx-sunpinyin-input-method">Finding the fcitx Sunpinyin input method</h3>
78 <p>This section will help you find the Sunpinyin input method, so you can then add it to your list of active input methods.</p>
79 <h4 id="to-find-the-fcitx-sunpinyin-input-method">To find the fcitx Sunpinyin input method</h4>
80 <ol type="1">
81 <li><p>Click the <strong>+</strong> symbol on the bottom-left of fcitx window</p>
82 <figure>
83 <img src="/assets/images/plus-clicked.png" alt="" /><figcaption>The plus symbol highlighted inside of the fcitx configuration window</figcaption>
84 </figure></li>
85 <li><p>Click <strong>Only Show Current Language</strong> to uncheck the <strong>Only Show Current Language</strong> box</p>
86 <figure>
87 <img src="/assets/images/unchecked.png" alt="" /><figcaption>A list of language input methods, and the option “Only Show Current Language” is unchecked inside of the fcitx configuration window</figcaption>
88 </figure></li>
89 <li><p>Click the <strong>search bar</strong></p></li>
90 <li><p>Search for sunpinyin</p>
91 <figure>
92 <img src="/assets/images/searching-sunpinyin.png" alt="" /><figcaption>A user searching for sunpinyin inside of the fcitx configuration window</figcaption>
93 </figure></li>
94 <li><p>Click <strong>Sunpinyin</strong> to select it</p></li>
95 <li><p>Click the <strong>OK</strong> button in the bottom-right of the window</p>
96 <figure>
97 <img src="/assets/images/ok-clicked.png" alt="" /><figcaption>Sunpinyin selected and the "OK" button held down inside of the fcitx configuration window</figcaption>
98 </figure></li>
99 <li><p>Ensure that <strong>Sunpinyin</strong> has been added to your list of input methods</p>
100 <figure>
101 <img src="/assets/images/sunpinyin-displayed.png" alt="" /><figcaption>The English US and Sunpinyin input methods listed in the fcitx configuration window</figcaption>
102 </figure></li>
103 <li><p>Click <strong>Global Config</strong> at the top of the window</p>
104 <figure>
105 <img src="/assets/images/global-config.png" alt="" /><figcaption>The "Global Config" tab highlighted in the fcitx configuration window</figcaption>
106 </figure></li>
107 </ol>
108 <h3 id="configuring-fcitx">Configuring fcitx</h3>
109 <p>This section will help you configure fcitx, so fcitx will be easier to access and use.</p>
110 <h4 id="to-configure-fcitx">To configure fcitx</h4>
111 <ol type="1">
112 <li><p>Click the <strong>Show Advanced Options</strong> tab in the bottom-left corner of the fcitx configuration window</p></li>
113 <li><p>Uncheck <strong>Use extra trigger key only after using it to inactivate</strong></p></li>
114 <li><p>Click the drop-down menu to the right of <strong>Extra key for trigger input method</strong></p></li>
115 <li><p>Choose <strong>Disabled</strong></p></li>
116 <li><p>Check <strong>Enable Hotkey to scroll Between Input Method</strong></p></li>
117 <li><p>Check <strong>Include Inactive when scrolling between Input Method</strong></p></li>
118 <li><p>Close the fcitx windows</p></li>
119 <li><p>Ensure your settings match the settings shown in the image below</p>
120 <figure>
121 <img src="/assets/images/advanced-options.png" alt="" /><figcaption>The "Global Config" settings in the fcitx configuration window</figcaption>
122 </figure></li>
123 </ol>
124 <h3 id="enabling-fcitx-at-startup">Enabling fcitx at startup</h3>
125 <p><a href="https://www.gnome.org/">Gnome</a> and <a href="https://xfce.org/">Xfce</a> desktop environments will automatically add <code>fcitx</code> to their startup applications.</p>
126 <p><a href="http://openbox.org/wiki/Main_Page">Openbox</a> requires you to put <code>fcitx &amp;</code> in your <code>~/.config/openbox/autostart</code> file. The <code>fcitx</code> part tells Openbox to start fcitx on startup, and the <code>&amp;</code> part tells your computer to run fcitx as a background process.</p>
127 <p>If you are not using Gnome, Xfce, or Openbox, continue to the section below.</p>
128 <h4 id="to-enable-fcitx-at-startup">To enable fcitx at startup</h4>
129 <ol type="1">
130 <li><p>Add the following contents to your <code>~/.xinitrc</code> file:</p>
131 <p>fcitx</p></li>
132 <li><p>Logout then log back in</p></li>
133 </ol>
134 <aside class="border">
135 <p>
136 <strong>Tip</strong>: If you don’t have an <code>~/.xinitrc</code> file, then you can create one by running <code>touch ~/.xinitrc</code>.
137 </p>
138 </aside>
139 <h3 id="making-sure-fcitx-is-working-correctly">Making sure fcitx is working correctly</h3>
140 <p>This section will guide you through a series of tests to ensure fcitx is workign correctly.</p>
141 <h4 id="to-make-sure-fcitx-is-working-correctly">To make sure fcitx is working correctly</h4>
142 <ol type="1">
143 <li>Open up something you can type text into</li>
144 <li>Hold down <strong>Ctrl</strong></li>
145 <li>While continuing to hold down <strong>ctrl</strong>, press <strong>spacebar</strong></li>
146 <li>Release <strong>spacebar</strong></li>
147 <li>Release <strong>Ctrl</strong></li>
148 </ol>
149 <p>You should now see the keyboard icon you saw earlier, if you have a taskbar, panel, or system tray .</p>
150 <figure>
151 <img src="/assets/images/sunpinyin-icon.png" alt="" /><figcaption>The Sunpinyin icon in a user's system tray</figcaption>
152 </figure>
153 <aside class="border">
154 <p>
155 <strong>Tip</strong>: If you do not see the keyboard icon mentioned above, check out the <a href="https://wiki.archlinux.org/blog.php/Fcitx">fcitx documentation</a>.
156 </p>
157 </aside>
158 </main>
159 </body>
160 </html>