gonewest818 / dimmer.el

Interactively highlight which buffer is active by dimming the others.
GNU General Public License v3.0
264 stars 14 forks source link

keep "active" buffer highlighted when focus in minibuffer & never dim minibuffer #10

Closed Dickby closed 4 years ago

Dickby commented 6 years ago

I think it would make sense to not dim the minibuffer, and not the "active" buffer when the real focus is on minibuffer

gonewest818 commented 6 years ago

Hi there. It should be possible to get this by setting the dimmer-exclusion-regex to match the name of the minibuffer(s), which will be *Minibuf-1*, *Minibuf-2*, etc. depending how many windows you have. Note those buffer names begin with a space, although Github's markdown might not be showing it very clearly in the browser.

But agreed, this could be more clear in the documentation at the very least, if not a distinct configuration flag for convenience.

dakra commented 6 years ago

I think @Dickby (and me) want to also not dim the current buffer selected before switching to the minibuffer. As of now, when I invoke swiper (which searches in the minibuffer) my main buffer gets dimmed.

gonewest818 commented 6 years ago

Aha, thanks for pointing that out.

Yes, that feature makes sense to me (and likely even more so if/when I get around to adopting iv/counsel/swiper myself).

NightMachinery commented 6 years ago

Same thing with helm and swoop :)

stardiviner commented 5 years ago

Same for company-mode and company-box, company-posframe (The later two use Emacs child-frame).

stardiviner commented 4 years ago

Gentle ping ....

gonewest818 commented 4 years ago

Noted!

gonewest818 commented 4 years ago

This is now possible with the code just merged into master compliments of @cmccloud. That build should appear in the next update to MELPA. I do need to update the documentation to make this new feature more obvious.

I'd appreciate some testing if you're still using dimmer.el. Wait for the next MELPA build (watch the build badges on the README), and when you've updated the package you can then configure something like this:

      (setq dimmer-fraction 0.33)
      (setq dimmer-exclusion-predicates
            '(helm--alive-p
              window-minibuffer-p))
      (setq dimmer-exclusion-regexp-list
            '("^\\*[h|H]elm.*\\*"
              "^\\*Minibuf-[0-9]+\\*"
              "^.\\*which-key\\*$"
              "^.\\*Echo.*\\*"))

See how that works for you...

dakra commented 4 years ago

Nice. I just tested it with this config:

;; Don't dim hydra, transient buffers or minibuffers
  (setq dimmer-exclusion-regexp-list '(" \\*\\(LV\\|transient\\)\\*"
                                       "^\\*Minibuf-[0-9]+\\*"
                                       "^.\\*which-key\\*$"
                                       "^.\\*Echo.*\\*"))
  (setq dimmer-exclusion-predicates '(window-minibuffer-p))

and it works nicely.

I would even suggest making it the default. How would want dimming for hyrdas, transient or minibuffer windows?

maronin commented 3 years ago

(setq dimmer-exclusion-predicates '(window-minibuffer-p))

Having this still dims the current active buffer if I use swiper to search for something... Am I missing something?

@dakra how did you get it to work with swiper?

Dima-369 commented 3 years ago

Having this still dims the current active buffer if I use swiper to search for something... Am I missing something?

I am also seeing the same behavior but I was able to disable dimmer for just swiper with this code:

Note that you have use the key bound below (in my case <escape>) to always quit out of swiper so dimmer-mode is correctly restored.

(defun swiper-no-dimmer ()
  (interactive)
  (dimmer-mode -1)
  (swiper))

;; swiper--action is called on confirming the line to jump to
(advice-add 'swiper--action :after 'dimmer-reenable)
(defun dimmer-reenable (x)
  (dimmer-mode +1))

(defun swiper-quit-enable-dimmer ()
  (interactive)
  (dimmer-mode +1)
  (call-interactively #'minibuffer-keyboard-quit)))

(define-key ivy-minibuffer-map (kbd "<escape>") 'swiper-quit-enable-dimmer)
dakra commented 3 years ago

I just checked and indeed it doesn't work with ivy/counsel/swiper anymore. I'm pretty sure it did work almost 2 years ago when I made that comment. I dim the buffers only very slightly so I never really noticed that it doesn't work and can't pinpoint when it stopped working.

gonewest818 commented 3 years ago

I've been looking at this and I can see what's causing the problem. Now I'm trying to figure out what's the right solution... running some tests.

mzacho commented 1 year ago

Any update on the right solution for this @gonewest818?