Difference between revisions of "Full screen"

From WikEmacs
Jump to navigation Jump to search
(2 tips for full screen mode)
 
 
Line 36: Line 36:
 
</source>
 
</source>
  
And now you can write in piece.
+
And now you can write in peace.
  
  

Latest revision as of 18:10, 30 August 2013

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.