使用原因
在 Linux 下中文输入法总是有许多问题需要解决。
- WeChat 无法输入中文,通过设置环境变量解决。
- 某一次更新后,又在 WeChat 下按下 ctrl 自动切换中英文,而我默认关闭了切换中英文的快捷键
我不再想反复处理这些问题,于是希望通过在 Emacs 来使用中文输入,系统只保留英文输入。然而 Emacs everywhere 不支持 Wayland。其次,在 Emacs 编辑像这样的大段文本也方便编辑
version
- system: Fedora 42
- WM: Hyprland
- Emacs: 30.1
- input method: Ficitx 5 and rime addon
bind = $mainMod, o, exec, emacsclient -c -e '(tinee)' -a ''
这个就是我的绑定
bind = $mainMod, o, exec, emacsclient -e '(tinee)' -a ''
这样无法运行
-e
== -eval
你能启用 toggle-debug-on-error
吗,然后尝试在 shell 上运行
emacsclient --eval '(tinee)' -a ''
,看看会发生什么?具体来说,请分享
调试信息以及 shell 的 STDERR
输出。
- 默认的推荐设置必须要有一个 Emacs 的 frame 打开
❯ emacsclient --eval '(tinee)' -a ''
nil
- 如果没有,则不会有任何 Emacs frame 弹出
❯ emacsclient --eval '(tinee)' -a ''
*ERROR*: Unknown terminal type
- 如果增加了
-c
参数
❯ emacsclient -c --eval '(tinee)' -a ''
nil
这时候 C-c C-c
文本会输出到 scratch
其次 C-c C-c
只是关闭了 window ,而 buffer 仍然存在
你正在使用 Emacs daemon/服务器吗? -a ''
这个参数应
该启动,如果它还没有启动的话。
你也可以在Codeberg上创建一个 issue 吗?
此外,请在 shell 中分享 echo $TERM
的输出。
我也在使用 hyprland
但还没有找到一种让它和非 daemon 的 emacs 交互的方法,我自己基本不启动 emacs daemon (主要是经常修改配置,方便重启)
emacs-everywhere.el 的 Github 上可以用 hyrpland 作为关键字查到相关 issue 和 wiki。
;; emacs everywhere
(setq emacs-everywhere-window-focus-command (list "hyprctl" "dispatch" "focuswindow" "address:%w"))
(setq emacs-everywhere-app-info-function #'emacs-everywhere--app-info-linux-hyprland)
(require 'json)
(defun emacs-everywhere--app-info-linux-hyprland ()
"Return information on the current active window, on a Linux Hyprland session."
(let* ((json-string (emacs-everywhere--call "hyprctl" "-j" "activewindow"))
(json-object (json-read-from-string json-string))
(window-id (cdr (assoc 'address json-object)))
(app-name (cdr (assoc 'class json-object)))
(window-title (cdr (assoc 'title json-object)))
(window-geometry (list (aref (cdr (assoc 'at json-object)) 0)
(aref (cdr (assoc 'at json-object)) 1)
(aref (cdr (assoc 'size json-object)) 0)
(aref (cdr (assoc 'size json-object)) 1))))
(make-emacs-everywhere-app
:id window-id
:class app-name
:title window-title
:geometry window-geometry)))
我成功启动了 emacsevery-where 然而 C-c C-c 无法粘贴内容。
在终端下似乎粘贴为
5~
x11 协议下:
Wayland 协议下的依赖没有明说,但是最基本的 wl-clipboard 肯定得有。
是,这个是最基本的。我还安装了 wtype 。现在,只能做到这个地步。