I use scratchpads in XMonad (my WM) extensively for quickly capturing (notes, TODOs etc) from anyhwere. I have an instance of Emacs running permanently in a workspace, and launch emacsclient as my scratchpad.

XMonad relies on WM_CLASS property of the frame(?) to identify if it should start new emacsclient instance, or if it should reuse it started previously. Before Emacs 27, this is how I used to start emacsclient from XMonad:

emacsclient -c --frame-parameters='(quote (name . "scratchmacs"))'

Before Emacs 27, doing a xprops | grep WM_CLASS would return "scrathmacs", but Emacs 27 keep giving "Emacs" instead. As a result, everytime I call my scratch-pad, a new window for emacsclient opens up :-(

I have done a bunch of googling and read through the documentation (albeit quite non-methodically), but got nowhere.

Evaluating (assoc 'name (frame-parameters)) in new emacsclient frame gives correct answer, i.e scratchmacs (but xprop for this frame still says emacs).

How can I set WM_CLASS of my choice for new emacsclient frames?

  • 2
    This bug report may be of interest: debbugs.gnu.org/41719 – Basil Aug 16 '20 at 9:37
  • Yeah, this bug is pretty much it. Doesn't look like there is much I can do without headache. I am holding resorting to launch st -n scratchmacs and then launching emacsclient in it for now. – channikhabra Aug 16 '20 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.