Re: [dev] daemon for DWM

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Sun, 28 Jul 2013 19:02:02 +0200

On Sun, Jul 28, 2013 at 06:11:39PM +0200, Markus Teich wrote:
> Am 2013-07-27 18:27, schrieb Martti K├╝hne:
> >On Mon, Jul 22, 2013 at 3:17 PM, Markus Teich
> ><markus.teich_AT_stusta.mhn.de> wrote:
> >>
> >>rx_now=0
> >>tx_now=0
> >>for i in /sys/class/net/*; do
> >> if [[ -d "$i" && ${i##*/} != "lo" ]]; then
> >> if [[ -f "$i/statistics/rx_bytes" ]]; then
> >> rx_now=($rx_now+`cat $i/statistics/rx_bytes`)
> >> fi
> >> if [[ -f "$i/statistics/tx_bytes" ]]; then
> >> tx_now=($tx_now+`cat $i/statistics/tx_bytes`)
> >> fi
> >> fi
> >>done
> >>let rx_rate=($rx_now-$rx_old)
> >>let tx_rate=($tx_now-$tx_old)
> >>
> >Might I ask what shell dialect is that written in? O_o
>
> Bash patched together with some stackoverflow answers.
> It probably is not beautiful, but it works for me until I finally have
> the time to write it in C. :/

I included some changes suggested by Markus in a rewrite of the netusage
functions for dwmstatus (attached; including an adapted dwmstatus-Makefile
for convenience).

Comments and criticism is welcome.

I will try to push a change request to the suckless sites git repo if
nobody threats to neuter my hamster over the code I wrote...


Cheers,

Silvan




Received on Sun Jul 28 2013 - 19:02:02 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 28 2013 - 19:12:06 CEST