branch: externals/logos commit d679de146e25962d5b0a94deb815b35de9fe844b Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Expand example for bar toggling and fix the code samples The code I had before was not toggling the mode on/off, whereas that is what we want to achieve. Thanks to Lasse Lindner for reporting the problem with those functions and for testing my proposed solution. This was done via a private channel and the information is shared with permission. --- README.org | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/README.org b/README.org index 3e810d3c6d..3c12ffdb04 100644 --- a/README.org +++ b/README.org @@ -511,32 +511,47 @@ restores it when ~logos-focus-mode~ is disabled. The (add-hook 'logos-focus-mode-hook #'my-logos-org-indent) #+end_src -*** Disable menu-bar and tool-bar +*** Disable menu-bar, tool-bar, tab-bar, tab-line :PROPERTIES: :CUSTOM_ID: h:8914f8fc-e6e9-440e-b037-f934e08ee1ae :END: -Continuing with the examples in this section of the manual, this is how -to disable the ~menu-bar-mode~ and ~tool-bar-mode~ when activating the -~logos-focus-mode~. +Continuing with the examples in this section of the manual, the code +block below shows how to disable the ~menu-bar-mode~, ~tool-bar-mode~, +~tab-bar-mode~, and ~tab-line-mode~ when ~logos-focus-mode~ is +enabled. If the modes are already disabled, the corresponding +function does nothing. Otherwise it toggles the mode off/on when +~logos-focus-mode~ is enabled/disabled. #+begin_src emacs-lisp ;; Assuming the `menu-bar-mode' is enabled by default... (defun my-logos-hide-menu-bar () - (logos-set-mode-arg 'menu-bar-mode -1)) + (when logos-focus-mode + (logos-set-mode-arg 'menu-bar-mode -1))) (add-hook 'logos-focus-mode-hook #'my-logos-hide-menu-bar) ;; Assuming the `tool-bar-mode' is enabled by default... (defun my-logos-hide-tool-bar () - (logos-set-mode-arg 'tool-bar-mode -1)) + (when logos-focus-mode + (logos-set-mode-arg 'tool-bar-mode -1))) (add-hook 'logos-focus-mode-hook #'my-logos-hide-tool-bar) -#+end_src -If those modes are already disabled, the following have no effect. -Otherwise they toggle the bars off while ~logos-focus-mode~ is enabled -and then restore them back on when ~logos-focus-mode~ is disabled. +;; Assuming the `tab-bar-mode' is enabled by default... +(defun my-logos-hide-tab-bar () + (when logos-focus-mode + (logos-set-mode-arg 'tab-bar-mode -1))) + +(add-hook 'logos-focus-mode-hook #'my-logos-hide-tab-bar) + +;; Assuming the `tab-line-mode' is enabled by default... +(defun my-logos-hide-tab-line () + (when logos-focus-mode + (logos-set-mode-arg 'tab-line-mode -1))) + +(add-hook 'logos-focus-mode-hook #'my-logos-hide-tab-line) +#+end_src ** Update fringe color on theme switch :PROPERTIES: @@ -599,8 +614,8 @@ Logos is meant to be a collective effort. Every bit of help matters. Vincent, Lucy McPhail, Omar AntolĂn Camarena, Philip Kaludercic, Remco van 't Veer, and user Ypot. -+ Ideas and/or user feedback :: Daniel Mendler, Dave Abrahams, Marcel - Ventosa, Xiaoduan, Ypot. ++ Ideas and/or user feedback :: Daniel Mendler, Dave Abrahams, Lasse + Lindner, Marcel Ventosa, Xiaoduan, Ypot. * GNU Free Documentation License :PROPERTIES: