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.
(assoc 'name (frame-parameters)) in new emacsclient frame gives correct answer, i.e
scratchmacs (but xprop for this frame still says
How can I set WM_CLASS of my choice for new emacsclient frames?