Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法通过命令自动同步字典配置 #421

Closed
all4fun opened this issue Jun 2, 2020 · 9 comments
Closed

无法通过命令自动同步字典配置 #421

all4fun opened this issue Jun 2, 2020 · 9 comments

Comments

@all4fun
Copy link

all4fun commented Jun 2, 2020

windows 下可以通过 "C:\Program Files\Rime\weasel-0.14.0\WeaselDeployer.exe" /sync
命令来执行词典同步,而Mac OSX 系统中
/Library/Input Methods/Squirrel.app/Contents/MacOS/rime_deployer
貌似并不支持这样的参数?

@LEOYoon-Tsaw
Copy link
Member

寫bash腳本唄

@all4fun
Copy link
Author

all4fun commented Sep 15, 2020

寫bash腳本唄

就是写脚本没找到支持的命令~

@Babesun
Copy link

Babesun commented Oct 26, 2021

寫bash腳本唄

就是写脚本没找到支持的命令~

rime_dict_manager -s 可以,但是会报一个LOCK文件的IO错误,需要先把LOCK文件更名。不过,bash脚本我不会写,大佬可以试一下

@iDvel
Copy link

iDvel commented Oct 26, 2021

你说的“同步字典配置”是指重新部署吗?
试试这个:

/Library/Input\ Methods/Squirrel.app/Contents/MacOS/Squirrel --reload

@lotem
Copy link
Member

lotem commented Nov 5, 2021

寫bash腳本唄

就是写脚本没找到支持的命令~

rime_dict_manager -s 可以,但是会报一个LOCK文件的IO错误,需要先把LOCK文件更名。不过,bash脚本我不会写,大佬可以试一下

​不要這樣做。
輸入法進程鎖住了打開的詞典文件,不支持併發訪問。
可以調用 .../Squirrel --quit; rime_dict_mananger -s 輸入法退出時短暫讓出詞典文件,在按任意鍵重新調起輸入法之前立即執行同步。

@all4fun
Copy link
Author

all4fun commented Nov 10, 2021

感谢回复。
完整命令可参考:

cd /Library/Input\ Methods/Squirrel.app/Contents/MacOS && ./Squirrel --quit; ./rime_dict_manager -s && cd -

@all4fun all4fun closed this as completed Nov 10, 2021
@nsdont
Copy link

nsdont commented Oct 9, 2022

我刚测试了下,我这边需要这么执行(需要在 ~/Library/Rime 下,才能执行成功)

#!/bin/bash
#
# put this script in ~/Library/Rime

cd ~/Library/Rime
DYLD_LIBRARY_PATH="/Library/Input Methods/Squirrel.app/Contents/Frameworks" "/Library/Input Methods/Squirrel.app/Contents/MacOS/Squirrel" --quit
DYLD_LIBRARY_PATH="/Library/Input Methods/Squirrel.app/Contents/Frameworks" "/Library/Input Methods/Squirrel.app/Contents/MacOS/rime_dict_manager" -s

@Babesun
Copy link

Babesun commented Oct 25, 2022

我刚测试了下,我这边需要这么执行(需要在 ~/Library/Rime 下,才能执行成功)

#!/bin/bash
#
# put this script in ~/Library/Rime

cd ~/Library/Rime
DYLD_LIBRARY_PATH="/Library/Input Methods/Squirrel.app/Contents/Frameworks" "/Library/Input Methods/Squirrel.app/Contents/MacOS/Squirrel" --quit
DYLD_LIBRARY_PATH="/Library/Input Methods/Squirrel.app/Contents/Frameworks" "/Library/Input Methods/Squirrel.app/Contents/MacOS/rime_dict_manager" -s

亲测成功!

不过我发现如果是-s命令在执行时的几秒钟如果持续在打字,就会在.userdb目录里出现一个lost目录,影响是有时候会出现字典损坏。这个有什么办法解决吗?

@pencilheart
Copy link

实现每隔5h同步一次,且正在输入时不打断输入

  1. 终端crontab -e进入vim编辑
  2. 添加0 */5 * * * if [ -n "$(pgrep 'Squirrel')" ]; then cpu_usage=$(ps -p $(pgrep 'Squirrel') -o %cpu=); if [ "$(echo "$cpu_usage == 0" | bc -l)" -eq 1 ]; then cd ~/Library/Rime && DYLD_LIBRARY_PATH="/Library/Input Methods/Squirrel.app/Contents/Frameworks" "/Library/Input Methods/Squirrel.app/Contents/MacOS/Squirrel" --quit && DYLD_LIBRARY_PATH="/Library/Input Methods/Squirrel.app/Contents/Frameworks" "/Library/Input Methods/Squirrel.app/Contents/MacOS/rime_dict_manager" -s; fi; fi
  3. !wq保存

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants