Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've got my Emacs running on a tag worker with server-start launched. I have a file manager opened somewhere else (another monitor for example) and when I open a text file with emacsclient it successfully opens in emacs but doesn't switch to it and doesn't rise it up.

What I'm looking for is a client specific signal in the rc.lua. Something like:

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

I want it to be only Emacs specific. And switch to the worker tag at the same time. Alternatively can I do it from Emacs rule callback?

Any ideas? :)

share|improve this question
1  
Nobody ever came across that? –  Alex March May 2 '12 at 13:59

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.