Awesome-wm сигнал, чтобы поднять клиента, когда фокус получен

1082
platforma

Я запустил Emacs на теге workerс server-startзапущенным. У меня есть файловый менеджер, открытый где-то еще (например, другой монитор), и когда я открываю текстовый файл с emacsclientним, он успешно открывается в emacs, но не переключается на него и не поднимает его.

То, что я ищу, это специфический для клиента сигнал в rc.lua. Что-то вроде:

client.add_signal("focus", function(c) c:raise() end) 

Я хочу, чтобы это было только для Emacs. И переключиться на workerтег одновременно. Или я могу сделать это из правила обратного вызова Emacs?

Есть идеи? :)

11
Никто никогда не сталкивался с этим? platforma 11 лет назад 1

1 ответ на вопрос

0
Tiago

I wanted the same thing, and your idea of an emacs callback is what finally worked. I have not tested it on awesome, but I am using dwm, and I suppose they are similar enough for this to work.

This is the callback function in 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 ) ) 

There are several ways to invoke the callback. For simplicity and flexibility, I have opted for a shell alias which invokes the callback and then the regular emacsclient:

$ alias edi alias edi='emacsclient -e "(raiseme)"; emacsclient -n' 

Hope it will still be useful ;)

For further reference on the message-type and values, see Window Manager Hints.

As for awesome's handling of this message, it seems that this event is handled. Source code is here.

Похожие вопросы