You are not logged in.

#1 2009-07-18 00:51:14

Allamgir
Member
Registered: 2009-06-11
Posts: 168

Can't get conky-cli and bash scripts to both display in dwm statusbar!

I'm trying to configure my dwm status bar to display some simple information using conky-cli and bash scripts. At first I tried just letting conky run the bash scripts (for network and volume state), but this increased my cpu usage by about 5%, which is significant considering I normally have 1-3% usage when idle. Also, I wanted to keep conky because it makes the display of certain information easy, such as cpu & RAM usage.

The problem is I'm having trouble getting both to display side by side. Here are the relevant parts of my .xinitrc:

network(){
iwconfig wlan0 2>&1 | grep -q no\ wireless\ extensions\. && {
  echo wired
  exit 0
}

essid=`iwconfig wlan0 | awk -F '"' '/ESSID/ {print $2}'`
stngth=`iwconfig wlan0 | awk -F '=' '/Quality/ {print $2}' | cut -d '/' -f 1`
bars=`expr $stngth / 10`

case $bars in
  0)  bar='[-------]' ;;
  1)  bar='[#------]' ;;
  2)  bar='[##-----]' ;;
  3)  bar='[###----]' ;;
  4)  bar='[####---]' ;;
  5)  bar='[#####--]' ;;
  6)  bar='[######-]' ;;
  7)  bar='[#######]' ;;
  *)  bar='[--!!!--]' ;;
esac

echo $essid$bar

exit 0
}

volume(){
vol=$(amixer get Master | awk -F'[]%[]' '/%/ {if ($7 == "off") { print "MM" } else { print $2 }}' | head -n 1)

echo Vol: $vol%

exit 0
}

conky | while true; read line; do xsetroot -name "`$line` `volume` `network` `date '+%a %m-%d-%Y %I:%M%p'`"; done &
exec dwm

(let me know if it would help to post any other files)

For some reason when I run this I only get the network/volume scripts and date running, updating every second (I think). The conky line just doesn't show up. I don't know what could be wrong, since I didn't see any error messages.


An even better solution would be to just have shell scripts to display CPU and MEM usage. I have a dual-core cpu, cpu0 and cpu1. I'd like to see both percentages if possible, or at least a percentage that is an accurate average of the two or something. In conky-cli I have something that shows:

cpu0/1: xx% xx%

Also, seeing RAM usage would help a lot. In conky it shows:

mem: xx% (xxxMB)


These are the ways I would like to have bash scripts show them, if possible, but I have zero skill in bash programming. I made this an option in case it's easier/cleaner/less resource hungry than a conky solution. Personally, if they're about the same in these aspects, I would prefer something with conky and the shell scripts because conky is so extensible, yet it's only flaw is executing scripts with minimal resource usage.

Help?


дɭɭɑӎɠїɾ

Offline

#2 2009-07-18 08:44:35

tadzik
Member
From: &tadzik
Registered: 2009-07-17
Posts: 91

Re: Can't get conky-cli and bash scripts to both display in dwm statusbar!

Hello,
I personally kicked out conky after migrating to dwm, and my statusbar displays load average (which is imho even better than cpu %), ram usage as you said, mpd info and the current time. And it goes like this:

#!/bin/sh
while true; do
  TEXT=$(echo "`cat /proc/loadavg | cut -c 1-14` | `free -m | awk '$1 ~ /^-/ {print $3}'` MB |`.scripts/mpdshort` `date +%k:%M:%S`");
  xsetroot -name "$TEXT";
  sleep 1;
done;

Hope this helps.
Regards,
Ted

Offline

#3 2009-07-18 13:30:48

Allamgir
Member
Registered: 2009-06-11
Posts: 168

Re: Can't get conky-cli and bash scripts to both display in dwm statusbar!

Thanks. I was thinking of using load average to save a few characters, but I didn't quite understand the numbers. I'll try that once I get to my Linux box, but could you please explain or post a link to something that explains load average (what's low, high, normal, etc.)?

EDIT: I found a website that explains loadavg. I now have my dwm status bar displaying it perfectly (yay!). Now I just need to add a few more things like battery status, etc. and I might be done. I'll probably post here if I have more questions, though.

Thanks for your help!

Last edited by Allamgir (2009-07-18 14:41:11)


дɭɭɑӎɠїɾ

Offline

#4 2009-07-20 02:51:41

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: Can't get conky-cli and bash scripts to both display in dwm statusbar!

Your conky stuff doesn't show up because you're trying to do command substition on $line.

Offline

#5 2010-02-02 15:58:44

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: Can't get conky-cli and bash scripts to both display in dwm statusbar!

I know this thread is old, but did you try dmplex? You can pipe stuff into it (in your case, your bash scripts and conky), then pipe the output of dmplex into your dwm statusbar. Works fine here with dzen2 and several different input scripts.

Offline

Board footer

Powered by FluxBB