
worker
我已經讓我的 Emacs在已啟動的標籤上運行server-start
。我在其他地方打開了一個檔案管理器(例如另一個監視器),當我打開一個文字檔案時,emacsclient
它在 emacs 中成功打開,但沒有切換到它,也沒有升起它。
我正在尋找的是rc.lua
.就像是:
client.add_signal("focus", function(c) c:raise() end)
我希望它只是 Emacs 特有的。並worker
同時切換到標籤。或者我可以從 Emacs 規則回調執行此操作嗎?
有任何想法嗎? :)
答案1
我想要同樣的東西,你的 emacs 回調的想法最終起作用了。我還沒有在 Awesome 上測試過它,但我正在使用 dwm,並且我認為它們足夠相似,足以使其工作。
這是emacs中的回調函數:
(defun raiseme ()
(x-send-client-message
nil ; DISPLAY - nil is selected frame
0 ; DEST - 0 is root window of display
nil ; FROM - nil is selected frame
"_NET_ACTIVE_WINDOW" ; MESSAGE-TYPE - name of an Atom as a string
32 ; FORMAT - size of the values in bits
'(1 "_NET_WM_USER_TIME" 0) ; VALUES
)
)
有多種方法可以呼叫回調。為了簡單性和靈活性,我選擇了一個 shell 別名,它呼叫回調,然後呼叫常規 emacsclient:
$ alias edi
alias edi='emacsclient -e "(raiseme)"; emacsclient -n'
希望它仍然有用;)
有關訊息類型和值的更多參考,請參閱視窗管理器提示。
至於awesome對這個消息的處理,好像是對這個事件進行了處理。原始碼是這裡。