Rime 小狼毫切换窗口重置默认中英状态
令我烦恼的是在 禁用 Rime 小狼毫输入法 Ctrl+Space 切换中英状态 调整之后,中英状态还是不够满意。
主要是它会记住当前窗口是哪个中英状态,在切走并切回来时保留,或者说还原到上次使用状态。
比如当前正在 Obsidian 中以中文模式码字,鼠标点击浏览器地址栏并手动切换到英文状态输入地址,再点回 Obsidian 会发现当前输入状态是中文。
这个行为非常地微软拼音,虽然比微软拼音好的一点是,小狼毫确实能按 Thread ID 精确地记住窗口输入状态,而不是混乱地时不时失灵。
但切换应用连带切换输入状态,相当于每次输入前都得关注当前窗口是什么状态。
手部的肌肉记忆切换不过来,不然就得把中英状态切换三次,插入 USB 接口的痛苦不要啊。
我想了个解决方法,就像 微软拼音输入法默认使用英语模式 的需求,每次切换窗口直接强制设置为默认英文的模式不就好了。
主体逻辑就是在 engine.process 下新增一个 lua_processor@*reset_ascii_mode,在识别到窗口切换时设置 ascii_mode
-- reset_ascii_mode.lua
-- Reset ASCII mode to default on Alt+Tab
local M = {}
function M.func(key_event, env)
local context = env.engine.context
-- when triggered with no key is pressed or released,
-- such as windows switchment, alt+tab, mouse click,
-- reset ascii_mode to default
if (not key_event:release()) and key_event:repr() == "0x0000" then
if not (context:get_option("ascii_mode") == true) then
context:set_option("ascii_mode", true)
return 1
end
end
return 2
end
return M
这里怎么识别窗口切换比较取巧,因为 API 的限制拿不到窗口的信息,key_event 也捕获不到 Alt+Tab 这种按键。调试时发现切换窗口时会产生一个什么都不按的 key_event,输出为 0x0000
aria2 使用 P12 证书错误
系统日志显示:
TLS 服务器 凭据的证书没有私钥信息属性。这通常出现在证书备份不正确,后来又被还原的情况下。此消息还说明证书注册没有成功。
SSPI 客户端进程为 aria2c (PID: 44300)。应用日志显示:
09/03 18:58:10 [INFO] RPC: Accepted the connection from ::1:10172.
09/03 18:58:10 [DEBUG] Creating TLS session
09/03 18:58:10 [INFO] CUID#11 - Error occurred while reading HTTP request
Exception: [src\tls\wintls\WinTLSContext.cc:231] errorCode=1 Failed to initialize WinTLS context handle然后在这里 配置https后无法连接rpc · 议题 #1379 · aria2/aria2 看到要剔除根证书,也就是打包进 p12 文件的证书只包含自身,不包含中间级和根证书。
看了下用 step ca certificate 创建的证书确实带中间级签发机构,删掉重新创建 P12 文件就好了。
GitHub Proxy 测速
wget --input-file=- --output-document=/dev/null --timeout=3 --tries=0 << EOF
https://github.com/zed-industries/zed/releases/download/v0.207.4/Zed-aarch64.dmg
https://gh-proxy.com/github.com/zed-industries/zed/releases/download/v0.207.4/Zed-aarch64.dmg
https://wget.la/github.com/zed-industries/zed/releases/download/v0.207.4/Zed-aarch64.dmg
https://ghproxy.net/github.com/zed-industries/zed/releases/download/v0.207.4/Zed-aarch64.dmg
https://ghfast.top/github.com/zed-industries/zed/releases/download/v0.207.4/Zed-aarch64.dmg
EOF| 服务网站 | 下载速度 | 网站主页 |
|---|---|---|
| https://github.com | 0.03 MB/s | release-assets.githubusercontent.com |
| https://gh-proxy.com | 14.9 MB/s | GitHub 文件加速代理 - 快速访问 GitHub 文件 |
| https://wget.la | 19.7 MB/s | Github文件|Docker镜像加速 |
| https://ghproxy.net | 8.43 MB/s | GitHub 文件加速 |
| https://ghfast.top | 0.5 MB/s | GitHub Proxy 代理加速 |