Macchina-CLI / macchina

A system information frontend with an emphasis on performance.
https://crates.io/crates/macchina
MIT License
1.24k stars 47 forks source link

ascii art positioning #183

Open hertg opened 2 years ago

hertg commented 2 years ago

I've glanced over the theme documentation and I don't think there's this possibility yet.

Add a setting to specify the position where the ascii art should be displayed. Currently, it always displays on the left. I have a fairly wide but short ascii art I'd like to use, it would look best if it was above the system info box. Having a wide ascii art side by side with the system info doesn't work well in narrow terminal windows.

Something like:

[custom_ascii]
# Possible values: top, right, bottom, left
# Default value: left
position = "top"
grtcdr commented 2 years ago

This is interesting, we could definitely do this :)

hertg commented 2 years ago

Just had an afterthought about that feature-request, so I'll just leave that here as a brain-dump, it may be a bit overkill (?)

Additionally to the positioning, specifying the alignment could also be pretty cool. Alignment could for example be an enum of: Start, Center, or End.

[custom_ascii]
# Possible values: start, center, end
# Default value: start
alignment = "center"

Example for what I mean:

       alignment: start                alignment: center               alignment: end
  _______  __________________              __________________              __________________
  |     |  |                |              |                |              |                |
  | img |  |                |     _______  |                |              |                |
  |_____|  |                |     |     |  |                |              |                |
           |      text      |     | img |  |      text      |     _______  |      text      |
           |                |     |_____|  |                |     |     |  |                |
           |                |              |                |     | img |  |                |
           |________________|              |________________|     |_____|  |________________|

If the textbox is larger than the ascii image, then the alignment could be applied to the box instead.

grtcdr commented 2 years ago

@123marvin123 How feasible would this be with the current structure?

123marvin123 commented 2 years ago

@123marvin123 How feasible would this be with the current structure?

It shouldn't be too hard, I think, but some things would need to be refactored to allow such a placement. Right now, we are using the ASCII art on the left side of the screen as an anchor to align the actual readout information.

I am currently too busy to work on this, maybe you can give it a try?

grtcdr commented 2 years ago

I am currently too busy to work on this, maybe you can give it a try?

Totally, just needed to know how big of a task this would be.

shajra commented 2 years ago

Can we please make this feature also include a way to disable the image as well? I like the information, but don't need the image, which also don't render well on my light-themed terminal.

grtcdr commented 2 years ago

If you're looking to disable ASCII art, just set hide_ascii = true in your theme.