mu4e-dashboard icon indicating copy to clipboard operation
mu4e-dashboard copied to clipboard

Add sampel for for side dashboard

Open credmp opened this issue 5 years ago • 6 comments

The side dashboard (screenshot 2) looks very promising. I would like to replicate this and then base my own config off of that one.

Could you please upload your configuration that resulted in screenshot 2?

Cheers, and thanks for making this.

credmp avatar Nov 27 '20 17:11 credmp

I was considering adding a function like this:

#+name: maybe-active-dashboard
#+begin_src emacs-lisp :results file file: /dev/null
  (mu4e-dashboard-toggle)
  (when mu4e-dashboard-mode
    (delete-other-windows)
    (split-window-right 30)
    (set-window-dedicated-p (get-buffer-window (current-buffer)) t))
#+end_src

however it falls down as a org-src snippet because mu4e-dashboard-mode is enabled the buffer is read only and causes a backtrace. I wonder if it makes sense add a local hook variable which mu4e-dashboard could run when it is enabled?

stsquad avatar Nov 27 '20 17:11 stsquad

So here is a better snippet which just installs the handler for creating a side-panel in as a local hook for the buffer when it is executed:

#+name: make-sidebar-on-activation
#+header: :results output
#+begin_src emacs-lisp 
  (defun my-make-dashboard-sidebar ()
    "Make the current mu4e-dashboard file a sidebar.
  Add this function as local tweak to mu4e-dashboard-mode-hook."
    (let ((side-w (get-buffer-window (current-buffer))))
      (if (not mu4e-dashboard-mode)
          (set-window-dedicated-p side-w nil) ; undo dedicated
        (delete-other-windows)
        (let ((headers-w (split-window-right 30)))
          ;; made side window "dedicated"
          (set-window-dedicated-p side-w t)
          (goto-char (point-min))
          (with-selected-window headers-w
            (mu4e-headers-search ""))))))

  (add-hook 'mu4e-dashboard-mode-hook 'my-make-dashboard-sidebar 0 t)
#+end_src

stsquad avatar Nov 27 '20 19:11 stsquad

@credmp It's really only a matter of writing the dashboard org file but I'll try to upload it yes.

@stsquad Nice! The hook on dashboard mode comes for free with the definition of any minor mode ? Could you make a PR?

rougier avatar Nov 28 '20 10:11 rougier

I thought that the sidebar had been created using https://github.com/rougier/nano-sidebar ? Am I right? I am still however trying to understand how to create a similar setup mainly with the different themes, as seen in https://github.com/rougier/nano-sidebar/blob/master/images/nano-sidebar-mu4e.png

pmatos avatar Oct 15 '21 14:10 pmatos

In my mu4e init, I've:

(require 'nano-sidebar)

(defun nano-sidebar-mu4e-init (frame sidebar)
  (select-frame sidebar)
  (find-file "~/.emacs.d/mu4e-dashboard.org")
  (mu4e-dashboard-mode)
  (hl-line-mode)
  (set-window-dedicated-p nil t)
  (forward-char 8)
  (setq header-line-format "")
  (face-remap-add-relative 'header-line
                           '(:height 1.2))
  (setq mode-line-format nil))

;;; Automatic mu4e dashboard sidebar when open mu4e
(add-to-list 'nano-sidebar-properties
   `("mu4e"    36 dark ,nano-dark-background nano-sidebar-mu4e-init) t)
(set-frame-parameter nil 'name "mu4e")
(nano-sidebar-toggle)

rougier avatar Oct 18 '21 17:10 rougier

@rougier that's really useful, thanks.

pmatos avatar Oct 18 '21 17:10 pmatos