git.m455.casa

m455.casa

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


html/archive/2019/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 <style>
17 body {
18 line-height: 1.5;
19 font-family: sans-serif;
20 font-size: 18px;
21 margin: 20px auto;
22 max-width: 630px;
23 }
24
25 a {
26 color: blue;
27 }
28
29 code, pre {
30 background-color: #fddee3;
31 font-size: 14px;
32 }
33
34 pre {
35 padding: 25px 25px;
36 overflow: auto;
37 }
38
39 pre code {
40 white-space: pre;
41 }
42
43 img {
44 max-width: 100%;
45 }
46
47 table {
48 border-collapse: collapse;
49 }
50
51 table caption {
52 font-weight: bold;
53 margin: 10px 0px;
54 text-align: left;
55 }
56
57 th, td {
58 border: 1px solid #000;
59 padding: 4px;
60 }
61
62 blockquote {
63 border-left: 3px solid #000;
64 padding-left: 10px;
65 }
66
67 .border {
68 border: 1px solid #000;
69 margin: 25px 0px;
70 padding: 5px 25px;
71 }
72
73 @media only screen and (max-width: 700px) {
74 body {
75 margin: 10px;
76 }
77 }
78
79 @media (prefers-color-scheme: dark) {
80 body {
81 background-color: #111;
82 color: #eee;
83 }
84 a {
85 color: #009fff;
86 }
87 code, pre {
88 background-color: #111;
89 color: #fd6363;
90 }
91 pre {
92 padding: 15px 25px;
93 }
94 blockquote {
95 border-left: 3px solid #666;
96 }
97 .border, th, td {
98 border: 1px solid #666;
99 }
100 }
101 </style>
102 </head>
103 <body>
104 <main>
105 <h2 id="setting-up-a-chinese-input-method-on-debian">Setting up a Chinese input method on Debian</h2>
106 <p>2019-11-05 00:00</p>
107 <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>
108 <p>This document consists of the following sections:</p>
109 <ul>
110 <li><a href="#conventions-used-in-this-guide">Conventions used in this guide</a></li>
111 <li><a href="#requirements">Requirements</a></li>
112 <li><a href="#downloading-the-fcitx-input-method-using-apt">Downloading the fcitx input method using apt</a></li>
113 <li><a href="#accessing-fcitxs-configuration-settings">Accessing fcitx’s configuration settings</a></li>
114 <li><a href="#finding-the-fcitx-sunpinyin-input-method">Finding the fcitx Sunpinyin input method</a></li>
115 <li><a href="#configuring-fcitx">Configuring fcitx</a></li>
116 <li><a href="#enabling-fcitx-at-startup">Enabling fcitx at startup</a></li>
117 <li><a href="#making-sure-fcitx-is-working-correctly">Making sure fcitx is working correctly</a></li>
118 </ul>
119 <h3 id="conventions-used-in-this-guide">Conventions used in this guide</h3>
120 <ul>
121 <li><strong>Note</strong>: Signifies additional information</li>
122 <li><strong>Tip</strong>: Signifies an alternative procedure for completing a step</li>
123 <li><strong>Warning</strong>: Signifies that damage, such as data loss, may occur</li>
124 <li><strong>Example</strong>: Shows how a procedure would be performed in a real scenario</li>
125 <li><code>Inline code and code blocks</code>: Signify package names, filenames, file contents, or commands</li>
126 <li><strong>Figure caption</strong> Signifies a description for a figure (an image)</li>
127 <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>
128 <li><strong>Bold font</strong> Signifies user interface items</li>
129 </ul>
130 <h3 id="requirements">Requirements</h3>
131 <ul>
132 <li>A Debian-based Linux distribution</li>
133 <li>A package manager (in this guide, I use the <code>apt</code> package manager)</li>
134 </ul>
135 <h3 id="downloading-the-fcitx-input-method-using-apt">Downloading the fcitx input method using apt</h3>
136 <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>
137 <h4 id="to-download-the-fcitx-package-using-apt">To download the fcitx package using apt</h4>
138 <ol type="1">
139 <li><p>Run the following command:</p>
140 <pre><code> sudo apt install fcitx fcitx-sunpinyin</code></pre></li>
141 <li><p>Confirm the installation by typing <code>y</code> when prompted</p></li>
142 </ol>
143 <h3 id="accessing-fcitxs-configuration-settings">Accessing fcitx’s configuration settings</h3>
144 <p>This section will help you access fcitx’s configuration settings, so you can then make using fcitx more convenient.</p>
145 <h4 id="to-access-fcitxs-configuration-settings">To access fcitx’s configuration settings</h4>
146 <ol type="1">
147 <li><p>Run <code>fcitx</code> on the command line to access fcitx’s configuration settings</p></li>
148 <li><p>Right-click the icon in your system tray</p>
149 <figure>
150 <img src="/archive/images/keyboard-icon.png" alt="" /><figcaption>A screenshot of the fcitx icon in the system tray</figcaption>
151 </figure></li>
152 <li><p>Click <strong>Configure</strong></p>
153 <figure>
154 <img src="/archive/images/click-configure.png" alt="" /><figcaption>A screenshot of the fcitx menu popping up after right-clicking the icon in the system tray</figcaption>
155 </figure></li>
156 </ol>
157 <aside class="border">
158 <p>
159 <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.
160 </p>
161 </aside>
162 <h3 id="finding-the-fcitx-sunpinyin-input-method">Finding the fcitx Sunpinyin input method</h3>
163 <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>
164 <h4 id="to-find-the-fcitx-sunpinyin-input-method">To find the fcitx Sunpinyin input method</h4>
165 <ol type="1">
166 <li><p>Click the <strong>+</strong> symbol on the bottom-left of fcitx window</p>
167 <figure>
168 <img src="/archive/images/plus-clicked.png" alt="" /><figcaption>A screenshot of the “+” symbol highlighted inside of the fcitx configuration window</figcaption>
169 </figure></li>
170 <li><p>Click <strong>Only Show Current Language</strong> to uncheck the <strong>Only Show Current Language</strong> box</p>
171 <figure>
172 <img src="/archive/images/unchecked.png" alt="" /><figcaption>A screenshot of a list of language input methods, and the option “Only Show Current Language” is unchecked inside of the fcitx configuration window</figcaption>
173 </figure></li>
174 <li><p>Click the <strong>search bar</strong></p></li>
175 <li><p>Search for sunpinyin</p>
176 <figure>
177 <img src="/archive/images/searching-sunpinyin.png" alt="" /><figcaption>A screenshot of a user searching for sunpinyin inside of the fcitx configuration window</figcaption>
178 </figure></li>
179 <li><p>Click <strong>Sunpinyin</strong> to select it</p></li>
180 <li><p>Click the <strong>OK</strong> button in the bottom-right of the window</p>
181 <figure>
182 <img src="/archive/images/ok-clicked.png" alt="" /><figcaption>A screenshot of sunpinyin selected and the “OK” button held down inside of the fcitx configuration window</figcaption>
183 </figure></li>
184 <li><p>Ensure that <strong>Sunpinyin</strong> has been added to your list of input methods</p>
185 <figure>
186 <img src="/archive/images/sunpinyin-displayed.png" alt="" /><figcaption>A screenshot of the English US and Sunpinyin input methods listed in the fcitx configuration window</figcaption>
187 </figure></li>
188 <li><p>Click <strong>Global Config</strong> at the top of the window</p>
189 <figure>
190 <img src="/archive/images/global-config.png" alt="" /><figcaption>A screenshot of the “Global Config” tab highlighted in the fcitx configuration window</figcaption>
191 </figure></li>
192 </ol>
193 <h3 id="configuring-fcitx">Configuring fcitx</h3>
194 <p>This section will help you configure fcitx, so fcitx will be easier to access and use.</p>
195 <h4 id="to-configure-fcitx">To configure fcitx</h4>
196 <ol type="1">
197 <li><p>Click the <strong>Show Advanced Options</strong> tab in the bottom-left corner of the fcitx configuration window</p></li>
198 <li><p>Uncheck <strong>Use extra trigger key only after using it to inactivate</strong></p></li>
199 <li><p>Click the drop-down menu to the right of <strong>Extra key for trigger input method</strong></p></li>
200 <li><p>Choose <strong>Disabled</strong></p></li>
201 <li><p>Check <strong>Enable Hotkey to scroll Between Input Method</strong></p></li>
202 <li><p>Check <strong>Include Inactive when scrolling between Input Method</strong></p></li>
203 <li><p>Close the fcitx windows</p></li>
204 <li><p>Ensure your settings match the settings shown in the image below</p>
205 <figure>
206 <img src="/archive/images/advanced-options.png" alt="" /><figcaption>A screenshot of the “Global Config” settings in the fcitx configuration window</figcaption>
207 </figure></li>
208 </ol>
209 <h3 id="enabling-fcitx-at-startup">Enabling fcitx at startup</h3>
210 <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>
211 <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>
212 <p>If you are not using Gnome, Xfce, or Openbox, continue to the section below.</p>
213 <h4 id="to-enable-fcitx-at-startup">To enable fcitx at startup</h4>
214 <ol type="1">
215 <li><p>Add the following contents to your <code>~/.xinitrc</code> file:</p>
216 <p>fcitx</p></li>
217 <li><p>Logout then log back in</p></li>
218 </ol>
219 <aside class="border">
220 <p>
221 <strong>Tip</strong>: If you don’t have an <code>~/.xinitrc</code> file, then you can create one by running <code>touch ~/.xinitrc</code>.
222 </p>
223 </aside>
224 <h3 id="making-sure-fcitx-is-working-correctly">Making sure fcitx is working correctly</h3>
225 <p>This section will guide you through a series of tests to ensure fcitx is workign correctly.</p>
226 <h4 id="to-make-sure-fcitx-is-working-correctly">To make sure fcitx is working correctly</h4>
227 <ol type="1">
228 <li>Open up something you can type text into</li>
229 <li>Hold down <strong>Ctrl</strong></li>
230 <li>While continuing to hold down <strong>ctrl</strong>, press <strong>spacebar</strong></li>
231 <li>Release <strong>spacebar</strong></li>
232 <li>Release <strong>Ctrl</strong></li>
233 </ol>
234 <p>You should now see the keyboard icon you saw earlier, if you have a taskbar, panel, or system tray .</p>
235 <figure>
236 <img src="/archive/images/sunpinyin-icon.png" alt="" /><figcaption>A screenshot of the Sunpinyin icon in a user’s system tray</figcaption>
237 </figure>
238 <aside class="border">
239 <p>
240 <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>.
241 </p>
242 </aside>
243 </main>
244 </body>
245 </html>