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?

1 Answer 1


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."
  (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

  • Where would I put that? Like a before-make-frame-hook? Dec 20, 2016 at 18:17
  • I tried before-make-frame-hook and that did not work. Dec 20, 2016 at 18:24
  • The recommendation from Emacs dev is to use display-graphic-p now, instead of window-system. I forget why. ;-) (But either will work.)
    – Drew
    Dec 20, 2016 at 20:53
  • Works for me thanks! Could you please remove the trailing space after menu-bar-lines?
    – Midiparse
    Nov 20, 2017 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.