I run both gui frames and tty frames on the same server. I'd like to only have the gui frames have the menu-bar and I want all tty frames to not have a menu bar.
I'm confused by the menu bar docs, is there a way to do this?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityI run both gui frames and tty frames on the same server. I'd like to only have the gui frames have the menu-bar and I want all tty frames to not have a menu bar.
I'm confused by the menu bar docs, is there a way to do this?
The function display-graphic-p
returns nil
for non-GUI Emacs. So something like the following should work:
(unless (display-graphic-p)
(menu-bar-mode -1))
My original answer only works for Emacs run only in a tty. Since you are using both GUI and TTY frames run from the same server, you need to modify individual frame parameters:
(defun contextual-menubar (&optional frame)
"Display the menubar in FRAME (default: selected frame) if on a
graphical display, but hide it if in terminal."
(interactive)
(set-frame-parameter frame 'menu-bar-lines
(if (display-graphic-p frame)
1 0)))
(add-hook 'after-make-frame-functions 'contextual-menubar)
display-graphic-p
now, instead of window-system
. I forget why. ;-) (But either will work.)
menu-bar-lines
?
Nov 20, 2017 at 12:08