Sailfetch

Rating: 
5
Your rating: None Average: 5 (6 votes)

Sailfetch is a Neofetch-like command line utility script for Sailfish OS.

I initially wanted to port Neofetch - or one of its predecessors - to Sailfish OS, but I quickly came to realize that's an unbelievably long and complicated Bash script. Most of it would have been unused for Sailfish OS, and as it's written for Bash, it wouldn't even work on BusyBox Ash.

Thus I essentially took the screenshot of Neofetch and cobbled up something alike.

Source code is available in GitHub.

Screenshots: 

Keywords:

Application versions: 
AttachmentSizeDate
File sailfetch-1.0.0-1.noarch.rpm7.82 KB30/09/2023 - 18:21
File sailfetch-1.1.0-1.noarch.rpm8.46 KB20/11/2023 - 01:29
File sailfetch-1.1.1-1.noarch.rpm8.6 KB20/11/2023 - 13:32
Changelog: 

1.1.1-1

  • Wait up to 2s for `stty size` to report terminal size
    • i.e. Fix using `sailfetch` in `~/.profile` with Fingerterm, ToeTerm etc.

1.1.0-1

  • Add usage text (-h)
  • Add support for flags
  • Make installed package count opt-in (-p)
  • Add support for vertical/horizontal logo vs. details printing (-V/-H)
  • Print details under the logo on narrow screens by default
  • Add flag to disable logo (-l)
  • Initial support for MicroSD card statistics
  • Add flag to disable printing colors (-c)
  • Use Shellcheck to check syntax

1.0.0-1

  • Initial release
  • Print kernel version
  • Print uptime
  • Print CPU and number of cores
  • Print number of installed packages
  • Print PackageKit and BusyBox versions
  • Print memory and disk statistics

Comments

Ahti30708's picture

10 II and 10 III with gnu-bash need the same change as the XA2 above.

2) The SD card is blk1 on the II, blk0 on the III

direc85's picture

Thanks for reporting! Sailfetch should run with BusyBox on the device, that may be the culprit independent of GNU Bash being installed or not. Could you please drop in an issue over at GitHub?

The same goes for the memory card partition -- I've seen both the card and the first partition of the card having the file system, so I guess the script should accommodate for both cases. Could you drop in another issue too?

Thanks!

Ahti30708's picture

Very nice. On the XA2 and gnu-bash:

Edit: this works for me around line 26:

if [[ $STTY_OK -ne 0 ]]; then
read -r ROWS COLS <<< $(stty size)
else

In line 26 the second < should be $ or something; it starts with $ but doesn't get the screen size and jumps to else.
Edit: "or something" is <<< $( instead of < <(
I commented out the if-then-else

/usr/bin/sailfetch: line 26: syntax error near unexpected token `<'
/usr/bin/sailfetch: line 26: `  read -r ROWS COLS < <(stty size)'

2) The SD card is mmcblk1, not 0.
3) The help text has -V for next to and -H for below.

fingus's picture

Cool and thank you. I miss the Resolution-Line :-)
 

direc85's picture

Screen resolution (and orientation) would be a nice addition! Could you drop in a GitHub issue? Thanks!

explit's picture

Cool, thanks.
How i can setup sailfetch, so that every time terminal or ssh session is startet it would run sailfetch?

On linux i would put it into .bashrc,
But SFOS has no .bashrc :(

direc85's picture

I whipped up a poor man's mitigation (retry-loop with sleep) to mitigate the situation, so now it works correctly without the `sleep 1`. For me it's more like `sleep 0.3` anyway. Now the delay is not noticable, and is up to 0.1s extra.

direc85's picture

Okay, it's a bit hacky, but when I put `sleep 1; sailfetch -lc` to `~/.profile`, it's able to then report the dimensions correctly. It looks like the commands are run before terminal dimensions are determined, and thus `stty` can't report the values.

First I pointed at Fingerterm, but I tested with ToeTerm, and it behaves identically. It could be a bug in BusyBox... Then again, I don't know if POSIX makes any promies about `.profile` or something.

direc85's picture

It looks like putting commands to `~/.profile` does the trick, for ssh connections at least. Fish shell doesn't read the file apparently - that's fine for me, as ssh starts with BusyBox shell anyway.

I noticed that Fingerterm doesn't report terminal width and height, so the auto detection doesn't work there. I see what I can do about it...

JellyRoll's picture

The extra home and root partition information is also very usefull, nice! Thank you for this one.

edp17's picture

Thanks for all your work. Not just this one but all the others. There is a neofetch (by Ferlanero) package available for Sailfish, so that may help you with your version.

direc85's picture

Thank you, I appreciate your words!

I didn't actually realize that Neofetch was already ported to Sailfish, but I might have a look and see if anything inspires me to add a feature I see!

One thing I already noticed was missing is memory card storage, so there will be an update at some point at least :)