Full screen

From WikEmacs
Revision as of 01:51, 13 February 2013 by Elvince (talk | contribs) (2 tips for full screen mode)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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"
  (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 piece.