rofi icon indicating copy to clipboard operation
rofi copied to clipboard

Can't input words in chinese or japanse with fcitx

Open theFool32 opened this issue 10 years ago • 22 comments

Version

1.2.0

arch+bspwm

Configuration

configuration

Launch Command

rofi -show run -lines 3

Steps to reproduce

launch rofi and type words.

What behaviour you see

can only input english letter. however, pasting chinese works.

What behaviour you expect to see

works with chinese. Thx. :smiley:

theFool32 avatar Oct 16 '16 07:10 theFool32

@sardemff7 ideas?

Can you give more information about how to reproduce this? I never type chinese or heard of fcitx.

DaveDavenport avatar Oct 16 '16 08:10 DaveDavenport

@DaveDavenport fcitx is an input method framework which i used to type chinese and japanse. You can reproduce this by installing fcitx and try to type chinese in rofi.

Or are there any successful example in typing other language? Thank you.

ps. my locale setting here.

> locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=

theFool32 avatar Oct 16 '16 09:10 theFool32

Yes, I had people test different languages with different scripts before.

DaveDavenport avatar Oct 16 '16 11:10 DaveDavenport

I can confirm it does not work. Unsure why though, I have 0 knowledge about this :(

DaveDavenport avatar Oct 16 '16 12:10 DaveDavenport

Did it use to work?

On the Arch wiki, I see this export: export XMODIFIERS=@im=fcitx, does it help? I think not but it’s not hard to test.

AFAICT, rofi never supported XIM, nor any input method. That would need a whole new extension to support, so a lot of code. This is the spec, as a potential starting point if anyone is willing to code it.

sardemff7 avatar Oct 16 '16 12:10 sardemff7

@sardemff7 I used rofi recently and find it doesn't work so I don't know whether it used to work. XMODIFIERS=@im=fcitx has been set already so it may not help.

Thanks for replying. :)

theFool32 avatar Oct 16 '16 14:10 theFool32

I also want to type Chinese in rofi ....

The author of fcitix has implemented a prototype https://github.com/wengxt/xcb-imdkit (9000+ lines of code) which can serve as a reference.

MaskRay avatar Mar 11 '17 20:03 MaskRay

Maybe adding support for searching romanized CJK charater is a better way, because switching IME needs extra key input anyway.

For example, when searching for 终端(Terminal in Chinese), we can input "zhong duan", which is a romanization for 终端.

Same goes for Japanese, searching 端末(Terminal in Japanese) can be done by searching "sankitsu".

As far as I know, softwares such as Spotlight, Alfred in macOS have similar behavior.

I will try implementing this functionality after 4 days or so.

lulitao1997 avatar Jan 13 '18 09:01 lulitao1997

I would bet Mac OS X to have either an helper to get the romanized version, or better files to begin with, and the tool has very little to do for such a feature. I am not sure we can add that to rofi with less work than IME integration.

sardemff7 avatar Jan 13 '18 09:01 sardemff7

Not sure if it helps anyhow, but just so you know, I can confirm that Korean input is not working either. I'm using ibus + ibus-hangul in ArchLinux (openbox) according to this guide: https://wiki.archlinux.org/index.php/Internationalization/Korean. It just won't switch to Hangul and would continue to type Latin characters. Pasting works, though.

balta2ar avatar Jan 23 '18 17:01 balta2ar

If anyone is looking for a dmenu replacement with XIM support, GTK+ based gdmenu did the trick for me. There's an AUR package for Archies.

moorchegue avatar Apr 21 '18 17:04 moorchegue

To sum up this, to input some of the east-asian languages (CJK languages, which means Chinese, Japanese, and Korean) on Linux, an IME is required. It's more than just a different keyboard layout due to the massive amount of characters of these languages. These IMEs are helpers that get input from keyboard, and show pop-ups that 'guess' the best match based on some phoenics things or integrated dictionaries, and also let the user to pick desired output.

Popular IME frameworks on Linux include fcitx and ibus.

kotatsuyaki avatar Jan 26 '19 13:01 kotatsuyaki

For those who are getting this issue, my personal workaround right now is to edit the .desktop entries with only Chinese / Japanese names, adding a GenericName property with the romanized version of their name to the applications. It then become searchable by using the roman name in rofi, with their GenericName being wrapped in parentheses after their Name. Not perfect, but at least it is usable.

kotatsuyaki avatar Jan 26 '19 14:01 kotatsuyaki

For those who are getting this issue, my personal workaround right now is to edit the .desktop entries with only Chinese / Japanese names, adding a GenericName property with the romanized version of their name to the applications. It then become searchable by using the roman name in rofi, with their GenericName being wrapped in parentheses after their Name. Not perfect, but at least it is usable.

@AkitakiKou Thanks for your kindly reply!

But this solution works only when the desktop application has no more than 1 instance. For example, when opening multiple pdf whose names with chinese characters included with llpp pdf viewer, then searching "llpp" will have multiple choices.

Of course one can bypass this dilemma by changing the names of pdf files to roman names.

zhenjieliang avatar Mar 23 '20 11:03 zhenjieliang

For those who are getting this issue, my personal workaround right now is to edit the .desktop entries with only Chinese / Japanese names, adding a GenericName property with the romanized version of their name to the applications. It then become searchable by using the roman name in rofi, with their GenericName being wrapped in parentheses after their Name. Not perfect, but at least it is usable.

@AkitakiKou Thanks for your kindly reply!

But this solution works only when the desktop application has no more than 1 instance. For example, when opening multiple pdf whose names with chinese characters included with llpp pdf viewer, then searching "llpp" will have multiple choices.

Of course one can bypass this dilemma by changing the names of pdf files to roman names.

Another imperfect workaround is using an external dialog to get your input, for example, in KDE, a translate script can be

while [ -n "$input" ]; do
	case "$input" in
        "#")  input="$(kdialog --title 'input' --inputbox "Input")" ;;
        *)  
        result=$(trans "$input")
        show $result;;
	esac
done

eggeek avatar Aug 21 '20 11:08 eggeek

Not support IME is like not support utf-8.

amitbha avatar Nov 03 '21 15:11 amitbha

@amitbha A patch to add IME support will be happily accepted.

As I mentioned before I have zero experience with it, nor am the right person to test it (as I never used it).

Replying just to complain without contributing anything to the solution is like standing on the street corner shouting your coffee is to cold.

DaveDavenport avatar Nov 03 '21 15:11 DaveDavenport

That's an overstatement, of course. Most written languages require unicode support, yet most or them (even some languages with alphabets that exceed hundreds of characters) don't require any IME. That said, for a subset of people it's a daily necessity, and among them such feature would be highly appreciated. I'd totally help with testing it if there was a PR.

moorchegue avatar Nov 03 '21 16:11 moorchegue

I also want to type Chinese in rofi.

yssource avatar Dec 02 '21 02:12 yssource

closing and locking this because of pointless 'bumps' (see guidelines). A patch or PR would be highly appreciated.

DaveDavenport avatar Dec 02 '21 08:12 DaveDavenport