5

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?

Aaron Jensen
  • 367
  • 3
  • 9

1 Answers1

13

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))

EDIT

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)

Source: https://stackoverflow.com/questions/24956521/how-can-i-hide-the-menu-bar-from-a-specific-frame-in-emacs

Tyler
  • 21,719
  • 1
  • 52
  • 92