Sometimes when i am writing something – the spread from east to west is annoying on a widescreen – the modeline also gives redundant information that are annoying – so I created this small mode to focus in on the job. Only creates the padding for org files since when writing elisp code the breadth is actually useful.
(defun focus-mode--backend (&optional left right)
(interactive)
(when (eq major-mode 'org-mode)
(set-window-margins (selected-window)
(if left
left
20)
(if right
right
20))))
(define-minor-mode focus-mode
"Toggle focus mode to adjust window margins."
:global t
:init-value nil
:lighter " f🎯"
(if focus-mode
(progn
(add-hook 'window-state-change-hook #'focus-mode--backend)
(setq-default mode-line-format '(
" "
"%n"
" "
"%b"
" "
"[%*]"
""
" f🎯"
" "
mode-name
)))
(progn
(remove-hook 'window-state-change-hook #'focus-mode--backend)
(focus-mode--backend 0 0)
(setq-default mode-line-format '("%e" mode-line-front-space
(:propertize
("" mode-line-mule-info mode-line-client mode-line-modified mode-line-remote)
display
(min-width
(1.0)))
mode-line-frame-identification mode-line-buffer-identification " " mode-line-position
(vc-mode vc-mode)
" " mode-line-modes mode-line-misc-info mode-line-end-spaces))
)))