Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: document the nil case for dirvish-default-layout. #231

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

nicolas-graves
Copy link
Contributor

Took me quite some time to found how I could disable the additional windows when starting (see #197). If you do not intend to change the code, I think this could be useful to more than me and should be documented. Hence this pull request.

@nicolas-graves
Copy link
Contributor Author

nicolas-graves commented Aug 7, 2023

Actually, that wasn't enough. In the end, I created a lightly reworked version of dirvish-layout-toggle for what I wanted :

(setq dirvish-default-layout nil)
(defvar rde-dirvish-default-layout '(1 0.11 0.55)
 "The default dirvish layout when not in fullscreen.")

(defun rde-dirvish-layout-toggle ()
  "Toggle layout of current Dirvish session.
A session with layout means it has a companion preview window and
possibly one or more parent windows."
  (interactive)
  (let* ((dv (dirvish-curr))
          (old-layout (dv-layout dv))
          (new-layout (unless old-layout
                           (or (dv-last-fs-layout dv) rde-dirvish-default-layout)))
          (buf (current-buffer)))
    (if old-layout
        (set-window-configuration (dv-winconf dv))
        (with-selected-window (dv-root-window dv) (quit-window)))
     (setf (dv-layout dv) new-layout)
     (with-selected-window (dirvish--create-root-window dv)
                                (dirvish-save-dedication (switch-to-buffer buf))
                                (dirvish--build dv)
                                (dirvish-debounce nil (dirvish-preview-update dv)))))

@alexluigit
Copy link
Owner

Hi, @nicolas-graves, thanks for your contrib! I'm merging it and will look into this issue later.

@alexluigit alexluigit merged commit 1bc2f93 into alexluigit:main Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants