rougier / elegant-emacs

A very minimal but elegant emacs (I think)
GNU General Public License v3.0
1.37k stars 78 forks source link

Customizing header/modeline and design ideas #22

Closed jacksonbenete closed 3 years ago

jacksonbenete commented 3 years ago

Hello there, I'm trying elegant-emacs but since I'm using God-mode it's a little confuse not knowing if god is activated. Sorry if the following sounds too much "my use case", but I would like to share some ideas and ask for some help in trying to improve it for god-mode.

I'm ok with the header being minimalist, I liked it, but unfortunately it's too much minimalist for me without showing the major-mode or some other hints like the god-mode, so I was thinking if there is a way to customize the header so I can try some things.

How can I change this icon? image

Could we define a header like in mu4e-dashboard where you have the RW/RO in a colored box? image

Let's call BOX the area of the header where we have either the icon or the RW/R0 colored boxes.

This would be enough for me. When god-mode is active I would have the BOX colored (just like R0), and when inactive it would be a grey BOX (just like RW). This background change would be very useful. I managed to put a background color into the entire bar, but didn't managed to figure out how to create this separation like in mu4e-dashboard. image

In fact I couldn't find yet where the icon is defined, or the elements where placed in the header. I'm a little busy but I will try to free up some time to investigate the code further. E.g. where are defined that the line:column would be in the end of the modeline and not in the center or right after the filename?

This "BOX" would be useful also for show the initials of the enabled major-mode, like instead of RW/R0, it could be EL (for elisp) or TXT. Would still be minimalist but way more informative.

Although it's not as "clean" as the current design, it would be a very useful option to toggle for someone using god or evil I think.

jacksonbenete commented 3 years ago

I found where the modeline is defined. Around line 150 at (setq-default mode-line-format ...).

So the "icon" is just a unicode character (U+2630).

Creating the BOX is just using a :background at face. image

You also can propertize using the construct %m to receive the major-mode, although it doesn't look good. image

I don't know how to use the god-mode-enabled-hook, since mode-line-format is just a variable to define everything, and not a function that can be "refreshed" I think. I'm new to elisp and Emacs but I will try to think about something. But I don't know if it will be a case of plug something in the right place or if I have to rewrite mode-line-format entirely as a function. It might not work.

rougier commented 3 years ago

Thanks for the feedback. I've actually started a new project at https://github.com/rougier/nano-emacs where I use the colored headerline and it should much easier to change. The reason is that I had difficulties make the elegant modeline consistent when there are several windows. If you look at nano-modeline.el, you'll see it is much easier to modify. All you need is one function to tell if you're in a given mode and another one that define what to write in the modeline.

jacksonbenete commented 3 years ago

Thanks! It worked. It's indeed easier to modify, although I think god-mode is tricky to detect, it worked.

image

I will follow nano-emacs closely. Although in the end I had to copy only some parts of the code into my own config because of some incompatibilities within my customs.