SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

MinimalMode

Strips Emacs of extraneous GUI elements (menu bar, tool bar, scroll bar), leaving a bare text-editing frame. Additionally, can switch to a full-screen mode, providing a minimal distraction free work environment (with all the power of Emacs hiding underneath!). I think it suits dark themes better (I use this color theme)(screenshot?)

By default, pressing F11 toggles this mode. With prefix argument ( C-u <f11> ) you’ll get the full-screen minimal mode.

Currently, the full-screen switching functions are specific to the X environment, which is what I use. For other environments, check out FullScreen.

To use it, add the following code to your .emacs:

(defun toggle-minimal-mode (fs)
  (interactive "P")
  (defun fullscreen-margins nil
    (if (and (window-full-width-p) (not (minibufferp)))
	(set-window-margins nil (/ (- (frame-width) 120) 2) (/ (- (frame-width) 120) 2))
      (mapcar (lambda (window) (set-window-margins window nil nil)) (window-list))))

  (cond (menu-bar-mode
	 (menu-bar-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1)
	 (set-frame-height nil (+ (frame-height) 4))
	 (if fs (progn (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
					      '(1 "_NET_WM_STATE_FULLSCREEN" 0))
		       (add-hook 'window-configuration-change-hook 'fullscreen-margins))))
	(t (menu-bar-mode 1) (tool-bar-mode 1) (scroll-bar-mode 1)
	   (when (frame-parameter nil 'fullscreen)
	     (remove-hook 'window-configuration-change-hook 'fullscreen-margins)
	     (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
				    '(0 "_NET_WM_STATE_FULLSCREEN" 0))
	     (set-window-buffer (selected-window) (current-buffer)))
	   (set-frame-width nil (assoc-default 'width default-frame-alist)))))

(global-set-key [f11] 'toggle-minimal-mode)