Cedric Martin
Cedric Martin

Reputation: 6014

Change the background color of the minibuffer when input is needed

Would it be possible to change the background color of the minibuffer when it's expecting user activity? For example when a function needs a parameter or when a function name is incomplete or when you started entering "C-x" and more keys are needed etc.

I'm thinking of something like this: http://emacswiki.org/emacs/Dedicated_Minibuffer_Frame (see "Minibuffer Background Color Indicates User Activity", with lots of screenshots)

Except that the above only works when the minibuffer is in its own frame.

I'd like to have it work when the minibuffer is a "regular" minibuffer, with other buffer(s) in the same frame.

My elisp is not strong enough yet to hack a solution to this myself so any input is very welcome.

EDIT

I can change the entire buffer's background doing the following:

(add-hook 'minibuffer-setup-hook 
  (function (lambda ()
              (set-background-color "black"))))

I don't know if it's easy to change only the minibuffer's background using some "hack".

I also don't know how to change back to the previous color. I'm not sure what's the correct way to do this.

If I can't change only the mini-buffer's background then changing the entire background is ok.

Upvotes: 4

Views: 2317

Answers (2)

Stefan
Stefan

Reputation: 28541

You can simply try to set face-remap-alist via minibuffer-setup-hook. Something like:

(add-hook 'minibuffer-setup-hook
          (lambda ()
            (make-local-variable 'face-remapping-alist)
            (add-to-list 'face-remapping-alist '(default (:background "green")))))

Upvotes: 5

rwb
rwb

Reputation: 558

It isn't perfect because it does not cover all of your conditions, but you can use M-x customize-face .. minibuffer-prompt and turn on inverse video or make other customizations. It only changes the background of the text not the whole minibuffer.

This does not change C-x or any other Prefix Command

Upvotes: 1

Related Questions