unixporn / trup

Discord bot for the Unixporn community
Mozilla Public License 2.0
47 stars 9 forks source link

Artix support, use more builtins, clearer print message #69

Closed eepykate closed 4 years ago

eepykate commented 4 years ago

Clarify that !setfetch without update deletes the image and fields that were set previously

Instead of trying to directly read /etc/os-release which will exit the whole script on distros (using a POSIX shell) that don't have it, abuse a for loop to go through /etc/os-release, /etc/lsb-release, then /etc/artix-release, then save and stop the loop if that file is found

Instead of using 2 awk commands to get the GTK theme / icon theme, use a single 'while read' loop then check for both at once using case.

Check for the variables "XDG_CURRENT_DESKTOP" and "DESKTOP_SESSION" before using 'xprop' / 'ps' to detect the WM manually, make 'ps' check for some wayland compositors ('sway', 'kiwmi' and 'wayfire') due to there being no reason not to

use a 'while read' loop instead of awk on /proc/cpuinfo

use 'read' on /proc/meminfo to get the first line instead of awk

Abuse sh variable substitutions on 'lspci | grep' instead of using sed, grep, and tr, still very ugly, but a better solution IMO

Don't check for the existence of $EDITOR, you can do variable substitution on unset variables without breaking anything

use 'defaults read' to get MacOS version instead of awk then variable substitution

elkowar commented 4 years ago

Nice!

eepykate commented 4 years ago

relevant: https://youtu.be/PvLz5kCVIss

eepykate commented 4 years ago

Thank you!

mlvzk commented 4 years ago

Thanks

eepykate commented 4 years ago

It turns out #40 has code worse than I thought. Among the things I mentioned there, the file isn't even a variable file, it has the contents

Artix Linux release and nothing more.