4

What face/text/other property should I use to have mode-line text look like a button/link/stuff to click on while I am hovering over it with the cursor?

Some examples:

  • different background,
  • 3D-like button decoration,
  • colorful frame/border displayed around it
  • other visual cues would be fine as well (as I don't know what choices are avaliable).

Otherwise it should just look like any ordinary text.

Below is a fragment of my custom mode-line which I'd like to enhance:

(setq mode-line-format
   (list
     (propertize
      (concat "[" (propertize "f" 'face 'aria2-modeline-key-face) "]:add file")
      'local-map (make-mode-line-mouse-map 'mouse-1 'aria2-add-file)) " "
     ;; [...]

PS: Is there some list of available text properties (for header/mode-line, buffer, frame border etc.) and their meanings?

2 Answers 2

6

You can use the mouse-face property.

For example, the following snippet will make "f" look like a button when you hover the mouse pointer over it:

(setq mode-line-format
   (list
     (propertize
      (concat "[" (propertize "f" 'mouse-face 'mode-line-highlight) "]:add file")
      'local-map (make-mode-line-mouse-map 'mouse-1 'aria2-add-file)) " "))
2

Face button or face link. Use M-x list-faces-display to see all faces currently defined.

(That said, I personally think that the standard behavior is not bad: mouseover to see whether a particular part of the mode line is a link/button and whether it has a menu etc.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.