Change X11 window title after emacs started
Asked Answered
G

3

10

When I start emacs, I can use the --title= option to control the title of the x-window that holds the emacs application. Is it possible to change the title after emacs starts from elisp?

Gildus answered 25/2, 2010 at 20:35 Comment(0)
S
12
M-x set-frame-name NewName RET

and from elisp

(set-frame-name "NewName")
Severn answered 25/2, 2010 at 20:42 Comment(2)
Doesn't work for me: GNU EMACS 24.3.1 on cygwin multiwindow X11. (set-frame-parameter frame 'title arg) works.Elver
That didn't work form me, either. I was also using 24.3.1, but on Windows. I tried Krazy Glews's suggetion without success, until reading his full answer bellow, then I figured out that, in my case, I just needed replace 'frame' with nil. So using (set-frame-parameter nil 'title "My desired title") did the trick for meCarlton
P
10

I use

(setq frame-title-format "%b - emacs")

to include the current buffer name in the frame title.

Pall answered 25/2, 2010 at 23:10 Comment(1)
Doesn't work for me: GNU EMACS 24.3.1 on cygwin multiwindow X11. (set-frame-parameter frame 'title arg) works.Elver
E
1

The following worked for me (GNU EMACS 24.3.1 on cygwin multiwindow X11):

 (set-frame-parameter frame 'title arg)

which I wrapped in an interactive function

(defun set-frame-title/ag (title &optional frame)
  "set frame TITLE of &optional FRAME defaults to (selected-frame)
aka C11 window titlebar name"
  (interactive "sframe title: ")
  (set-frame-parameter frame 'title title)
  )
Elver answered 19/6, 2014 at 17:55 Comment(1)
Satisfies my immediate need: some day I will tweak my frame-title-format to optionally mix in a frame specific name in combination with what I already do ("emacs hostname display pid user")Elver

© 2022 - 2024 — McMap. All rights reserved.