Awesome-wm a signal to rise client when focus received

Solution 1:

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.