Setting frame/window name in Emacs
One of the on going things for me is tweaking and improving my workflow in XMonad. I have been using NamedScratchPad for emacs in my xmonad config to easily summon one of my fav editor(Emacs) to the workspace I am in. The reason for me to do this is that since I made the move to emacs I use org-mode for managing my todo/tasks, notes,etc. and don’t want to do alot of workspace jumping. And having a namedscratchpad allows me to stay in the workspace and bring emacs into the workspace when I need it!
But more recently I started creating multiple emacs daemons, as I didn’t want the open buffers shared across certain instances of Emacsclient. Having multiple daemons was one of the ways that I discovered to keep my buffers isolated. Having multiple instances of Emacs caused an issue with how I work with my emacs namedscratchpad where using the namedscratchpad shortcut key would move the newly created Emacs instance to/from NSP workspace. So the other instance would be in the NSP workspace until I kill the newly created instace. That was pretty annoying! To get around this problem I needed a way to set the title of my namedscratchpad emacs window instance so that I can use that name in my xmonad config.
To set the frame name you need to start emacs by setting the
--frame-parameters in the commandline options:
emacsclient -nc --frame-parameters='(quote (name . "floatingemacs"))
This is how my xmonad.hs looked initially:
scratchpads = [
NS "emacs" "emacsclient -nc" (appName =? "emacs") defaultFloating,
After setting the frame name I can now have to use title instead of appName in xmonad config to bring/move namedscratchpad instance of emacs.
scratchpads = [
NS "emacs" "emacsclient -nc --frame-parameters='(quote (name . \"floatingemacs\"))'" (title =? "floatingemacs") defaultFloating,
Now I can have multiple emacs daemons without interrupting my workflow with scratchpad emacs.
Edit: So I made this blog post because it wasn’t clear right away that
set frame name was I wanted because I wanted a way for me identify the namedscratch instance of emacs. Frame name basically changes the title of the emacs window, which would otherwise be user@hostname. And I made the same mistake of not mentioning that in the post. By setting the frame name I am changing the window title of the namedscratchpad emacs which I am leveraging to isolate it from other emacs instances in my xmonad config.