Full screen

From WikEmacs
Jump to navigation Jump to search

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"
  (when (eq window-system 'x)
     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 ()
      (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))

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

And now you can write in peace.