davatorium / rofi

Rofi: A window switcher, application launcher and dmenu replacement
https://davatorium.github.io/rofi/
Other
13.07k stars 608 forks source link

Can't input words in chinese or japanse with fcitx #483

Closed theFool32 closed 2 years ago

theFool32 commented 7 years ago

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:

DaveDavenport commented 7 years ago

@sardemff7 ideas?

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

theFool32 commented 7 years ago

@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=
DaveDavenport commented 7 years ago

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

DaveDavenport commented 7 years ago

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

sardemff7 commented 7 years ago

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.

theFool32 commented 7 years ago

@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. :)

MaskRay commented 7 years ago

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.

lulitao1997 commented 6 years ago

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.

sardemff7 commented 6 years ago

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.

balta2ar commented 6 years ago

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.

moorchegue commented 6 years ago

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.

kotatsuyaki commented 5 years ago

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 commented 5 years ago

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.

zhenjieliang commented 4 years ago

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.

eggeek commented 4 years ago

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
amitbha commented 2 years ago

Not support IME is like not support utf-8.

DaveDavenport commented 2 years ago

@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.

moorchegue commented 2 years ago

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.

yssource commented 2 years ago

I also want to type Chinese in rofi.

DaveDavenport commented 2 years ago

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

DaveDavenport commented 1 year ago

Patch been merged!

DaveDavenport commented 11 months ago

Link to PR: https://github.com/davatorium/rofi/pull/1735