joewing / jwm

Joe's Window Manager
http://joewing.net/projects/jwm
MIT License
520 stars 84 forks source link

Trying to 'swallow' a shell script. #578

Closed scarduck closed 2 years ago

scarduck commented 2 years ago

Hi,

My objective is to have the following info on my jwm tray: https://0x0.st/o1ND.png

I saw an old post (from a now ghost user) saying it was possible to swallow a shell script to display system info on the tray. So I tried the following:

1) simple "echo" system info shell script: jwmtray2

#!/bin/bash
while(true);do
sleep 1
LOAD=`sudo cat /proc/loadavg|awk '{print $1}'`
CPUTEMP="`sensors | grep "Core 0" | awk '{print $3}' | cut -d. -f1 | cut -d+ -f2`°"
CPUGOV=`cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | tail -1`
CRAM=`free -t | awk 'FNR == 2 {printf("%.2f%"), $3/$2*100}'`
echo "RAM: $CRAM | CPU: $LOAD/$CPUTEMP"
done

2) swallowing the script from .jwmrc

<Swallow name="jwmtray2" width="0" height="24">
~/jwm/scripts/jwmtray2
</Swallow>

But my tray shows nothing. Any clue?

Thank you in advance.

yetanothergeek commented 2 years ago

The Swallow tag is intended to capture an X11 window, I don't think it can output raw text from a shell script.

You can try my "says" application, it is a small strip that will give you RAM and CPU usage along with some other stats (if desired). It currently doesn't support CPU temperature but I think it wouldn't take too much effort to add that feature, at least for common Intel and AMD chips.

https://github.com/yetanothergeek/says

scarduck commented 2 years ago

Thanks for the info and app suggestion, I'll give it a try.

Joe: Please make my post a feature request if possible, thank you.

GHLieven commented 2 years ago

See here for my answer.

scarduck commented 2 years ago

Solved. Thank you @GHLieven and @yetanothergeek