SivanLaai / rime-pure

【rime 小狼毫\trime 同文】手机/PC一站式配置【简约皮肤\拼音搜狗词库\原创trime同文 四叶草 九宫格 拼音方案\四叶草拼音\四叶草地球拼音\小鹤双拼\极品五笔\QQ五笔\徐码\郑码】
http://blog.laais.cn/posts/projects/rime/info/
MIT License
918 stars 88 forks source link

[trime-v3.2.16-0-g5738657b-release][四叶草九宫格][在编辑界面有个搜索按钮,我想把它换成别的,可以做到吗?] #126

Open yhm-amber opened 3 months ago

yhm-amber commented 3 months ago

误触这个按钮时的后果实在过于恶毒,我已经有数次因为误触这个按钮而失去了我在浏览器编辑了半天的文本。

复现步骤

正确的结果

这个按钮可以被改为别的。

使用设备情况(请完整填写如下信息):

SivanLaai commented 3 months ago

可以,你要改trime.yaml这个文件

yhm-amber commented 3 months ago

可以,你要改trime.yaml这个文件

感谢。


不过我遇到一个问题,当我不分大小写地搜索 baidu 时我只找到了这样一部分:

......
  Homepage: {label: 同文主頁, command: run, option: "https://github.com/osfans/trime"} #查看網頁: run 網址
  CommitHomepage: {label: 同文網址, commit: https://github.com/osfans/trime} #直接上屏
  Wiki: {label: 維基, command: run, option: "https://zh.wikipedia.org/wiki/%s"} #搜索網頁: %s或者%1$s爲當前字符
  Google: {label: 谷歌, command: run, option: "https://www.google.com/search?q=%s"} #搜索網頁: %s或者%1$s爲當前字符
  MoeDict: {label: 萌典, command: run, option: "https://www.moedict.tw/%3$s"} #搜索網頁: %3$s爲光標前字符
  Baidu: {label: 百度搜索, command: run, option: "https://www.baidu.com/s?wd=%4$s"} #搜索網頁: %4s爲光標前所有字符
  Zdic: {label: 漢典, command: run, option: "http://www.zdic.net/sousuo/?q=%1$s"} #搜索網頁: %s或者%1$s爲當前字符
  Zdic2: {label: 漢典, command: run, option: "http://www.zdic.net/sousuo/?q=%2$s"} #搜索網頁: %2$s爲當前輸入的編碼
  WebSearch: {label: 搜索網頁, command: web_search, option: "%4$s"} #搜索,其他view、dial、edit、search等intent,參考安卓的intent文檔:https://developer.android.com/reference/android/content/Intent.html
  Search: {label: 搜索, command: search, option: "%1$s"} #搜索短信、字典等
  Share: {label: 分享, command: send, option: "%s"} #分享指定文本: %s或者%1$s爲當前字符
  Deploy: {label: 部署, command: broadcast, option: "com.osfans.trime.deploy"}
  Sync: {label: 同步, command: broadcast, option: "com.osfans.trime.sync"}
  RepeatCommit: { label: 重复,  command: commit, option: "%1$s" } #重复输入刚上屏的内容
......

看起来我似乎能够选择我用什么搜索,但我并没有找到这个配置。不应该是另外一个地方被填写了 Baidu 这个标签才使得那个按钮是百度搜索吗?

另外,我尝试删除这行,但程序崩溃,然后我的这个 yml 文件就回到了原来的样子(不作改动它也照样会在部署的时候崩溃但因为崩溃完了也能用我就没管它)。


哦,我找到了,应该是在 同文风增强版.trime.yaml 文件里,最后地部分:

......
  ChineseDate: {label: 农历, send: function, command: date, option: "zh_CN@calendar=chinese"} #农历等日期(>=Android 7.0):date 语言@calendar=历法 格式。具体參見https://developer.android.com/reference/android/icu/util/Calendar.html
  Time: {label: "™", send: function, command: date, option: " HH:mm:ss "}
  Flypy: {label: "键盘", send: Menu }
  Handian: {label: 金山, functional: false, send: function, command: run, option: " http://www.iciba.com/word?w=%3$s"}
  Xiaohe: {label: 小鹤主页, functional: false, send: function, command: run, option: "http://www.flypy.com"}
  Baidu: {label: 百度, functional: false, send: function, command: run, option: "https://www.baidu.com/s?wd=%3$s"}
  Tieba: {label: 贴吧, functional: false, send: function, command: run, option: "com.baidu.tieba"}
  TrimeCmp: {label: 同文组件, send: function, command: run, option: "com.osfans.trime/ .Pref"} #运行程序指定组件:run包名/组件名
  date_time: {label: time, send: function, command: date, option: "yyyy-MM-dd  HH:mm:ss"}
  HDSS: {label: 金山, functional: false, send: function, command: run, option: " http://www.iciba.com/word?w=%3$s"} # 搜索网页: %3$s为光标前一个字符或选中字符或未上屏首选词条
  BDHY: {label: Ⓓ, send: function, command: run, option: "https://hanyu.baidu.com/s?wd=%3$s"}
  XHIX: {label: 鹤形, send: function, command: run, option: "http://www.xhup.club/?search_word=%4$s"}
  BDSS: {label: 🔍️, send: function, command: run, option: "https://www.baidu.com/s?wd=%4$s"} # 搜索网页:%4$s为光标前所有字符或选中字符或未上屏首选词条
  LLQ: {label: Ⓛ, send: function, command: web_search, option: "%4$s"} # 直达光标前http开头的网址或搜索光标前内容
......

那个放大镜就是我要找的那个令人困扰地按钮啦。

yhm-amber commented 3 months ago

同文风增强版.trime.yaml 中我把相应行的网址做了修改:

....
  BDSS: {label: 🔍️, send: function, command: run, option: "https://duckduckgo.com/?ia=chat&q=%4$s"} # 搜索网页:%4$s为光标前所有字符或选中字符或未上屏首选词条
....

我觉得这肯定是一种不规范的 hack ,因为前面的标签还是 BDSS 即“百度搜索”的含义,我怕程序中对这部分是硬编码的,因此没对它做改动。

现在这个按钮会自动跳转到鸭鸭去的 AI 聊天页面,我觉得这很不错。

我不知道这里的问题 —— 如:并没有一个比较明确的位置来编辑这个放大镜按钮的点击效果;以及:我不知道要怎么改动这个按钮的功能好让它不是触发搜索而可以是别的什么 —— 是否在本软件的修复目标内,因此我先不关闭这个 issue 。