neofetch style system info for norns
nornsfetch on GitHubWorking on tiny term got me thinking about other things I could do from the command line. Since tiny-term can't run terminal based programs, I decided to make a system info script like neofetch for norns. Over a weekend, I cobbled together v1.0 and learned a lot about lua, norns, and linux.
I used the norns 'util' library extensively to execute the commands in the OS and return the output to the norns screen.
The os capture function handles the majority of these requests.
I wrote a function that formats the uptime
to show only days, hours, minutes, and cut
and awk
to display only the necessary information from some of the other commands.
"disk " .. util.os_capture([[df -h -t ext4 --output=size,used | awk '{if ($1w != "Size") print $2 "/" $1}']]), uptime_display, "ker " .. util.os_capture([[uname -r | cut --delimiter="-" --fields=1]]), "res 128x64", "pkgs " .. util.os_capture("dpkg-query -f '.\n' -W | wc -l"), "temp " .. norns.temp .. "c", "ver " .. util.os_capture("cat ~/version.txt"), util.os_capture("whoami") .. "@" .. util.os_capture("uname -n"), util.os_capture("iwgetid -r"), util.os_capture("hostname -I"), util.os_capture("ls /home/we/dust/code | wc -l") .. " scripts", "/audio " .. util.os_capture("du -sh /home/we/dust/audio | cut --fields=1")
My initial ascii art for the factory norns and norns shield worked okay, but I wanted it to look more accurate.
So, I built it up character by character using screen.move
and screen.text
to have more fine-grain control over character placement.
O's
+------------+
|o O O O |
|[___] o o |
+------------+
period and degree °
+-----------+
| .° |
|[___] .°.° | +-----------+
I was originally going to use is_norns
and is_shield
to detect which version of norns the user had to display the relevant ascii art, but decided against that and used encoder two to switch between the ascii drawings.
The first version of the script had two ascii art options that shared the same information display on the right side of the screen. I wanted to display more information, specifically kernel version, pi temperature, and wifi information. I got to work making a third screen option that would eschew the ascii art in favor of more information.
With that page added, I considered the script complete and submitted it to be featured in the maiden script library and norns.community library.