Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snapshot flag for scripting purposes #358

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jwilkins88
Copy link

Hey there! I've been using nvtop and I love the functionality. I wanted to add an applet to Linux Mint, so I added a flag to output the stats as a static snapshot for that purpose

Purpose

Adds -s flag to cli to aid in scripting the output of nvtop

Details

When I first started trying to use nvtop for scripting out an applet (for Linux Mint Cinnamon desktop environment), ncurses wasn't playing nice with the runtime for the applets. I couldn't find any suitable alternatives that gave me the information I was looking for, so I decided to modify nvtop for my personal use case and thought others may be able to get some benefit from it as well.

This doesn't modify any core functionality of the application, and simply bypasses the ncurses initialization in order to print a static snapshot to STDOUT.

Screenshots

The command + output

/home/xxxxxxxx/nvtop-dev/usr/local/bin/nvtop -s 
                          
Device: AMD Radeon RX 7700S; GPU Clock: 198MHz; Mem Clock: 96MHz; Temp: 41C; Fan: 29%; Power: 1W; GPU Util: 0%; Mem Util: 0%; 
Device: AMD Radeon 780M Graphics; GPU Clock: 800MHz; Mem Clock: 1000MHz; Temp: 45C; Fan: CPU Fan; Power: 13W; GPU Util: 12%; Mem Util: 51%;

The resulting "applet" that I created using the output

image

Disclaimers

I am not a C developer. I've never actually written in C before, so this was a great learning experience for me.

Thanks for taking a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant