eepykate / fet.sh

🐢 a fetch written in posix shell without any external commands (sponsored by https://git.io/kiwmi)
https://github.com/buffet/kiwmi
ISC License
366 stars 22 forks source link

Resolution #22

Closed mfs closed 4 years ago

mfs commented 4 years ago

Was wondering if there was a way to display resolution while staying POSIX sh only. This is the best I could come up with so far. May not work on all versions of xorg/configurations and could break in other ways. Perhaps someone could come up with something better. :)

https://github.com/mfs/fet.sh/tree/resolution-hack

eepykate commented 4 years ago

That is indeed a hack.

I don't even have ~/.local, so for starters you should have used XDG environment variables.

And I don't have anything in XDG_DATA_HOME/xorg

And you could have removed

    resolution=${resolution##*initial mode }

and set resolution to that when it was first set (instead of resolution=$line; break)

eepykate commented 4 years ago

Also I forgot to mention this somehow, but this would also break multi-monitor setups.

Xorg would display it was the combined width/height of all of the monitors, as that's how Xorg works.

mfs commented 4 years ago

Yeah, this might be a bit of a stretch for sh. :) Maybe a generic way of displaying content from an env variable that could be set externally e.g in xinitrc. Feels like a bit of a cheat though.

This is a really neat script.