Comments (19)
I'm stuck away from the test setup tonight - but should be able to pull to test first thing in the morning (about 12h). I'll plan to pull latest at that time and test against all current open issues to get caught back up to state of the code. Thanks!
from sysfetch.
Follow up - took a look at the code, this is failing because there is no swap configured on the system in question. Easy fix for that is to filter with an if statement for a one-line /proc/swaps.
That does mean there will also be a bug on any system with more than one swap space configured, as well.
from sysfetch.
Can you verify if /proc/swaps exist on your system without a swapfile or partition?
from sysfetch.
Confirmed, the file /proc/swaps still exists - it's one line only, just the headers. A system with multiple swap spaces will have numswaps+1 for file length. You can filter based on $(cat /proc/swaps | wc -l) to get line count. Have just started that on a branch, will test and send you a pull to look at shortly.
from sysfetch.
Great idea thank you!
from sysfetch.
Also - as I was working swap, discovered this issue is actually two issues. The pstree output above is part of determining the terminal, but was showing up on the swap line. Realized this while cleaning up swap. Hence, PR #24 will resolve the swap portion, but not the extraneous output quoted above.
OpenWRT and a lot of slim systems don't have pstree - I'm looking to see if there's an alternate clean method.
from sysfetch.
Further addendum on terminal determination, ps -p "$PPID" -o comm=
is a nice alternative without pstree, but the trimmed down version of ps in busybox doesn't support any flags to ps.
I'd complain, but you can fit the entire OS into 8MB, trimming the fat has to happen somewhere!
Will continue looking to see if any of the simplified methods will work under busybox. If not, we might just have to filter it out like we did elsewhere for uptime --pretty. (This is easy to do for busybox versions of commands, because all of the normal command locations like /bin/ps are always symlinks to /bin/busybox instead of standalone programs. Busybox gets so skinny by compiling in all the commands so it can share libraries and resources really efficiently.)
from sysfetch.
I avoided the PR to keep code clean, I made a commit with what I believe should fix the issue for you. The fix is based on your idea to use line count and should print all swap partitions as well. Further testing with multiple swaps will have to be done
from sysfetch.
Thanks! I should be able to test in a moment, sending a quick band-aid suggestion to cover systems without pstree (I'm not finding an alternative supported by busybox, so maybe better to return an unknown instead of a jumble of error output)
from sysfetch.
The terminal deal wasn't easy to drop $TERM shell variable for Linux in general so I can imagine it'll be difficult for busybox. Thanks for the PR
from sysfetch.
Okay, tested commit df4d0c2 on the swap read - still gives an issue on swap read. However, now it's just an extraneous newline that's not getting parsed right. Just leaving out the entire swap ~
chunk if we can get rid of that \n
would work just fine.
Current snippet of output on OpenWRT/busybox:
ram ~ 919 MiB\n
-ash: ./fetch.sh: pstree: not found
term ~ shell ~ ash
from sysfetch.
I'm not sure what is causing the swap line to get bad pstree output on BusyBox, which could only be from the term variable found below.. Hopefully last commit fixed spacing
from sysfetch.
Currently erroring out on the load averages addition before output gets to swap/term - will switch over to see what's going on there, then switch back to checking this once I can verify.
from sysfetch.
I commented it out for now. May be best to create a new branch for load avs or just make a script for load avgs then once the script functions make PR. I can make a new branch for you to push like test_load
from sysfetch.
That makes sense! It was working well on my x86 system, but I suspect ash shell was having a problem somewhere in there. I'll work with the commented version of saintphaenixos original code and see which part was giving it trouble. Thanks!
from sysfetch.
Can you pull latest commit and check output now?
from sysfetch.
Okay, have had a chance to pull and update tests based on commit c3092ba with following results:
Ram portion skips cleanly across the swap section, since there is no swap on this box. No newline at the end. Still get a shell complaint that pstree isn't there. I like the direction your solution is going, I think it's just out of order in the code. Output:
ram ~ 919 MiB-ash: ./components/term_shell.sh: pstree: not found
screen
shell ~ ash
Code as it is right now:
# // TERM // get terminal name w/ pstree
shell="$(echo $SHELL | sed 's%.*/%%')"
term="$(pstree -sA $$)"; term="$(echo ${term%%---${shell}*})"; term="$(echo ${term##*---})"
if [[ $(command -v pstree) ]] ; then
echo -ne "${GREEN}term${NC} ~ "
echo $term | tr -d '\n'
else
echo $TERM
fi
Code as needed to fix the issue, you should just need to move the pstree line inside the if (which I think is what you meant to do originally) and the header line back out:
# // TERM // get terminal name w/ pstree
shell="$(echo $SHELL | sed 's%.*/%%')"
echo -ne "${GREEN}term${NC} ~ "
if [[ $(command -v pstree) ]] ; then
term="$(pstree -sA $$)"; term="$(echo ${term%%---${shell}*})"; term="$(echo ${term##*---})"
echo $term | tr -d '\n'
else
echo $TERM
fi
As you can see from my output, it's still getting "screen" okay on my simplified system (that's what tmux should report there), so it's just switching the position of those two lines, and I believe output will be fixed.
As a test, I just did that quickly on my local copy, and it solved everything except missing newline on the ram/swap line, this is the output with those two lines switched around:
ram ~ 919 MiBterm ~ screen
shell ~ ash
from sysfetch.
I will try that! Idk much about the string of code used currently it was made by @SimoneSalzano
#15 duplicate error
from sysfetch.
The terminal is found in a completely different way now and should work as intended! I'm keeping #15 open and closing this
from sysfetch.
Related Issues (20)
- DE/WM themes not working again HOT 2
- Current Build: Theme category not showing: HOT 17
- de/wm not detected correctly (xsessions) HOT 8
- Uptime display supposed to be like this?: HOT 3
- Add support for Windows and Mac HOT 13
- CPU Frequency issue under WSL2: HOT 3
- KDE / KRunner / Latte Dock `term` Value
- Wrong values for TERM and WM HOT 16
- syntax error: invalid arithmetic operator HOT 1
- lsblk: /dev/nvme0n1p: not a block device HOT 30
- Errors on Qemu HOT 4
- Arch WSL2 output very slim HOT 2
- Errors on Android via Termux HOT 4
- Not able to access drive and exiting on Alpine HOT 2
- No output on Fedora VM HOT 4
- Slim output on MINGW Windows HOT 1
- Verbose option HOT 5
- Several ascii art missing HOT 1
- Suggestion: rename sysfetch to sysfetch.sh HOT 1
- ASCII art not working.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sysfetch.