Full screen

From WikEmacs
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

How to use Emacs in full screen mode ?


Full screen on X11

The following maps the function 11 key to toggle fullscreen on X11 (Linux, BSD, etc…).

Add this in your .emacs :

(defun toggle-fullscreen ()
  "Toggle full screen on X11"
  (interactive)
  (when (eq window-system 'x)
    (set-frame-parameter
     nil 'fullscreen
     (when (not (frame-parameter nil 'fullscreen)) 'fullboth))))

(global-set-key [f11] 'toggle-fullscreen)

However, I tested it on Emacs23 and it does not replace my window correctly if it was maximised, so I prefer the following method :

Using external program

Install wmctrl (sudo apt-get install wmctrl). Add the following in your .emacs :

    (defun switch-full-screen ()
      (interactive)
      (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))

    (global-set-key [f11] 'switch-full-screen)

And now you can write in peace.