jlesage / docker-firefox

Docker container for Firefox
MIT License
1.42k stars 267 forks source link

Can put Fcitx software packge in the docker image? #146

Open lifetraveler opened 1 year ago

lifetraveler commented 1 year ago

Hi!some user like me,a chinese,use the docker-firefox for searching or input with my own mother language, but the docker-firefox only support english ime,the Fcitx software packge is a chinese ime,i wish docker-firefox can release with Fcitx ,thank u!

nibazshab commented 1 year ago

U can input CJK fonts at outside anywhere, and COPY & PASTE into docker-firefox

need a web clipboard, like jishiben.me ( not AD )

lifetraveler commented 1 year ago

thank u. something like this docker-firefox in qnap nas os,called browser station,the way to handle this is just popup a floating box ,you can use your own ime to put chinese into it(pic 1),when its done,it passthough the text to the browser (pic 2)。 image

image

nibazshab commented 1 year ago

oh, it also can, just need do this

  1. COPY fonts
  2. PASTE into left panel
  3. PASTE at docker-firefox

image

lifetraveler commented 1 year ago

i know the way,i hope it can be more easier without cv :) but thank u

jlesage commented 1 year ago

Do you know if there is a Firefox plugin that offer this functionality ?

jlesage commented 1 year ago

Also, the BrowserStation in QNAP seems to be a Chrome browser. Do you have anything to do to activate the popup floating window ? Is this implemented via a plugin ?

lifetraveler commented 1 year ago

yeah,its chrome brower, :)

--do you have anything to do to active the popup floating window ? Is this implemented via a plugin ? just switch my IME(Input Method Editors) into chinese mode,when you put key down ,its automatic active. i google a lot about that, some one says its maybe hard to image that for english user,there is a weblink to learn more about it.

here is a gif to get it qnap browser

lifetraveler commented 1 year ago

now i use the clipboard in sidebar. :),i may Take some time to get used to it。

qnap browser station is seemed to be a little slowlier when work with chinese input and not support proxy in browser。 your docker-firefox image support proxy,its much important than a chinese ime for me . thank u

jlesage commented 1 year ago

just switch my IME(Input Method Editors) into chinese mode,when you put key down ,its automatic active.

Who is providing this IME (the floating window) ? Is it your OS or the BrowserStation ?

lifetraveler commented 1 year ago

they are two parts,the floating window is provided by BrowserStation.IME is on the OS

tsurara-guobin commented 1 year ago

Hi!some user like me,a chinese,use the docker-firefox for searching or input with my own mother language, but the docker-firefox only support english ime,the Fcitx software packge is a chinese ime,i wish docker-firefox can release with Fcitx ,thank u!

Someone has packged ibus for alpine(download link). I have installed and started it. But it doesn't take effect in firefox. Maybe it is caued by some config. I installed fcitx in arch, and ime didn't take effect too. The problem was resolved by export environment config in startup script of my application. But it didn't resolve my problem in apline. 英语太过跛脚,我补充下中文:在百度贴吧我看过一个帖主打包了apline的ibus输入法。我安装了,也启动了。但是在firefox中不生效。不知道是不是环境变量的问题。之前我在arch的docker容器中装过fcitx,应用中输入法也是不生效,通过在应用的启动脚本中增加变量解决的。但我在alpine中没有解决,有兴趣你也可以试试。

tsurara-guobin commented 1 year ago

they are two parts,the floating window is provided by BrowserStation.IME is on the OS

kasm also provides this function. But it takes much more space.

h2y commented 1 year ago

Using userscript in Firefox can auto read Clipboard on change, and input it into page. it is useful to me. @tsurara-guobin @lifetraveler

  1. Enter about:config in navigation bar
  2. Search dom.events.testing.asyncClipboard dom.events.asyncClipboard.readText and set true
  3. install a userscript addon such as https://addons.mozilla.org/zh-CN/firefox/addon/violentmonkey/
  4. add a userscript:
// ==UserScript==
// @name        auto Clipboard
// @match        https://*/*
// @match        http://*/*
// @grant       none
// @version     1.0
// @author      h2y
// @description 27/03/2023, 17:31:59
// ==/UserScript==

(_ => {
    let lastTxt = ""
    setInterval(_ => {
        let inp = document.querySelector("input:focus, textarea:focus");
        if (!inp) return;
        navigator.clipboard.readText().then(txt => {
            if (txt != lastTxt) {
                lastTxt = txt;
                if (inp.value != txt) inp.value = txt;
            }
        });
    }, 2000)
})()
sxcsfan commented 11 months ago

Using fcitx in this image is fairly simple.

  1. Start your docker-firefox container as usual
  2. Run docker exec -it #your_started_container_name# sh
  3. Run apk add fcitx5 fcitx5-chinese-addons --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing to install fcitx input method
  4. Commit your changes to the image
  5. Modify startapp.sh, start fcitx along with firefox
  6. Start your container with the following env variables set
    • LANG=zh_CN.UTF-8
    • XMODIFIERS=@im=fcitx
    • GTK_IM_MODULE=fcitx
    • QT_IM_MODULE=fcitx`
  7. Use Ctrl + Space to switch between English and Chinese
image
shishugen commented 10 months ago

在此图像中使用 fcitx 相当简单。

  1. 像往常一样启动 docker-firefox 容器
  2. 跑步docker exec -it #your_started_container_name# sh
  3. 运行apk add fcitx5 fcitx5-chinese-addons --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing安装fcitx输入法
  4. 提交对图像的更改
  5. 修改startapp.sh,启动fcitx和firefox
  6. 使用以下环境变量集启动容器

    • 语言=zh_CN.UTF-8
    • X修饰符=@im=fcitx
    • GTK_IM_MODULE=fcitx
    • QT_IM_MODULE=fcitx`
  7. 用于Ctrl + Space切换英文和中文
图像

Can you provide a mirror image? thank you

pengfeiu commented 4 months ago

Dockerfile

FROM jlesage/firefox RUN apk add fcitx5 fcitx5-chinese-addons --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing ENV GTK_IM_MODULE=fcitx \ QT_IM_MODULE=fcitx \ XMODIFIERS=@im=fcitx \ SDL_IM_MODULE=fcitx5 \ LANG=zh_CN.UTF-8

docker exec -it firefox sh nohup fcitx5 > /dev/null 2>&1 &

image

GODU-LZR commented 3 months ago

在此图像中使用 fcitx 相当简单。

  1. 像往常一样启动 docker-firefox 容器
  2. 跑步docker exec -it #your_started_container_name# sh
  3. 运行apk add fcitx5 fcitx5-chinese-addons --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing安装fcitx输入法
  4. 提交对图像的更改
  5. 修改startapp.sh,启动fcitx和firefox
  6. 使用以下环境变量集启动容器

    • 语言=zh_CN.UTF-8
    • X修饰符=@im=fcitx
    • GTK_IM_MODULE=fcitx
    • QT_IM_MODULE=fcitx`
  7. 用于Ctrl + Space切换英文和中文
图像

Can you provide a mirror image? thank you

按照这个来进入火狐浏览器网页发现 Ctrl+space 切换不了输入法 然后进入firefox容器内 fcitx5-remote 会发现与dbus连接失败 然后apk下载dbus-demo和dbus,创建好用户组、文件夹、环境变量给予足够权限 后重启fcitx5,会发现fcitx5 报 E2024-04-23 16:43:51.530199 addonloader.cpp:61] Failed to create addon: dbus Unable to request dbus name. Is there another fcitx already running?