Memory and CPU status in limepanel

Dear all,
I have installed minimal bspwm. My question is how can I add RAM and CPU usage in ~/.limepanelrc.
I don't need fancy icons or bars, just a text works for me more than enough.
Thanks!

cp /usr/bin/limepanel ~/.bin/mypanel
chmod +x ~/.bin/mypanel
micro ~/.bin/mypanel

Then edit mypanel to your liking and replace limepanel with mypanel in your autostart.

Here are some ways to get cpu and mem usage:

"Memory $(free -m | grep '^Mem' | awk '{print "total: " $2 "MB used: " $3"MB"}') | CPU $(top -bn 1 | grep '^Cpu' | tr -d 'usy,' | awk '{print "user " $2 ", sys " $3}')

There are more efficient ways too. You could also use conky-cli for example. Remember not to loop it too often, otherwise it gets heavy on the cpu.

conky -c ~/.config/bspwm/panel/conkyrc-lemonpanel > "$PANEL_FIFO" &
4 Likes

The @Chrysostomus solution is worked.
Here is part of mypanel according to the solution above.

  • Define mem class:
mem(){
    free -m| grep '^Mem' | awk '{printf("RAM:%.1f%%", $3/$2*100) }'
}
  • Add $(mem) to one of the if conditions you want, e.g
	if [ "$wifi_indicator" = true ]; then
		while	:; do
		echo "C%{A:"$networkmenu":}$(sigStrength)%{A} $(mem) %{A:dbright:}$(battery)%{A}  $time_icon $(clock)"
		sleep "$update_interval"
		done
  • Similar will work for any bash command you want to print or echo on the bar, including CPU usage.
1 Like

Forum kindly sponsored by