Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want a keyboard shortcut to open emacs in a maximised window. I tried emacs --fullscreen, but that is full screen rather than maximised window... That is, the emacs window covers ubuntu menu bars. emacs -fw gets a full width window and emacs -fh gets a full height window, but if you put both options, it only reads the second one. At the moment, I just have another keyboard shortcut for maximising a window. Is there a way to get emacs to start maximised?

Ubuntu 9.10, emacs 22, if that makes a difference.

share|improve this question
up vote 3 down vote accepted

I have this in my .emacs, which I then bind to a key:

(defun my-frame-toggle ()
  "Maximize/Restore Emacs frame using 'wmctrl'."
  (shell-command "wmctrl -r :ACTIVE: -btoggle,maximized_vert,maximized_horz"))

(global-set-key [(control f4)] 'my-frame-toggle)

You can then hit CtrlF4 and toggle between regular and full-screen (but not covering the Ubuntu menu bar and bar at the bottom of the screen whose name I'm blanking on at the moment). To start up that way simply invoke it:

$ emacs -e "my-frame-toggle"
share|improve this answer

I had the same problem. Found the answer in this thread:

Basically from the command line start emacs with this parameters:

  • emacs -fs //if you want emacs to cover all your screen (cover the ubuntu bar)
  • emacs -mm //if you want emacs to start like you pressed the maximize button (shows ubuntu bar)

Of course you can bind those starting options to an icon and have emacs always start the way you want.

share|improve this answer
Superb! emacs -fs works perfectly in Ubuntu 12.10 – Chris McCauley Dec 5 '12 at 14:52

I have the following functions in my .emacs, which first defines the codes to send the window manager to maximize the frame on and Win32 respectively, and then add this as a setup hook, if applicable:

(defun x-maximize-frame ()
    "Maximize the current frame (to full screen)"
    (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
    (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))

(defun w32-maximize-frame ()
  "Maximize the current frame (to full screen)"
  (w32-send-sys-command 61488))

(defun maximize-frame ()
    (if (eq window-system 'w32)

(if window-system
    (add-hook 'window-setup-hook 'maximize-frame t))
share|improve this answer

This might be what you're looking for. You could also hard-code the pixel width/height for your screen, and set that in your .emacs file (the author covers that here).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .