How to edit fcitx tables & fix broken inputs

I've found some characters missing from fcitx-table-cangjie5 and would like to add them.

I've tried nano /usr/share/fcitx/table/cangjie5.mb but it always freezes.

Questions:

  1. Are there any commands like (making this up to demonstrate the functionality I want):

cat -ni cangjie5.mb (to list all entries for ni) and

insert -ni -3 𠚤 cangjie5.mb (to insert 𠚤 in the 3rd position under ni)?

  1. Is there a way to convert a ***.mb to ***.csv or some other more easily editible format?

Thanks.

Update: My fcitx-table-cangjie5 (primary input) is now broken. Please help. I tried editing based on https://github.com/frantic1048/fcitx-table-cangjie5-colemak

These are essentially the commands I ran:

sudo cp /usr/share/fcitx/table/cangjie5* ~/editing-directory/
cd ~/editing-directory/
mkdir backup
cp cangjie5* backup/
mb2txt cangjie5.mb >cangjie5.txt
nano cangjie5.txt
txt2mb cangjie5.txt cangjie5.mb
mv cangjie5.mb cangjie5-edit.mb
mv cangjie5.conf cangjie5-edit.conf
sudo cp cangjie5-edit* /usr/share/fcitx/table/

I was then able to see and edit the .conf file from the gui config tool, but the table changes did not take effect when I tested them.

So I restarted fcitx and cangjie was gone. I couldn't add it with the configuration settings either.

I tried:

sudo rm /usr/share/fcitx/table/cangjie5-edit*
sudo cp ~/editing-directory/backup/cangjie5* /usr/share/fcitx/table/

and restarted fcitx, but that didn't work.

I tried:

sudo apt-get purge fcitx-table-cangjie5
sudo apt-get install fcitx-table-cangjie5

but it's still broken.

All other fcitx input methods are still working.

I'm not sure where else fcitx files are stored to even troubleshoot?

Any help is much appreciated.
Thanks.


Solution 1:

Steps:

1. Install your fcitx inputs and fcitx-tools. For example:

sudo apt-get install fcitx-anthy fcitx-chewing fcitx-hangul fcitx-rime fcitx-table-cangjie5 fcitx-table-boshiamy fcitx-tools libzhuyin13

2. Launch fcitx: fcitx -d

3. (optional) Backup your configuration:

cp ~/.config/fcitx ~/dotconfigfcitxbackup/
cp /usr/share/fcitx ~/usrsharefcitxbackup/

4. Edit your live fcitx table

cd ~/.config/fcitx/table/
mb2txt tablename.mb >tablename.txt
nano tablename.txt

Note: if you're adding phrase inputs or more candidates for a given input, you may need to increase the indicated parameters below.

For example:

;fcitx Version 0x03 Table file
KeyCode=1234567890abcdefghijklmnopqrstuvwxyz
Length=12   <==== For returning longer phrases as outputs
Pinyin=@
PinyinLength=9  <==== for allowing 9 candidates for a given input
Prompt=&
ConstructPhrase=^
[Data]
2m2o 輕鬆輸入法
...

5. Convert back to ***.mb

txt2mb tablename.txt tablename.mb

6. Test your configuration to see it working.

7. (If something goes wrong) & you didn't backup:

rm ~/.config/fcitx -R
rm /usr/share/fcitx -R
sudo apt-get purge fcitx*

Then reinstall (step 1 above).

8. (If something goes wrong) and you did backup:

rm ~/.config/fcitx -R
rm /usr/share/fcitx -R

cp ~/dotconfigfcitxbackup/fcitx ~/.config/
cp ~/usrsharefcitxbackup/fcitx /usr/share/

Sources:

I learned about fcitx-tools from https://github.com/frantic1048/fcitx-table-cangjie5-colemak .