You are not logged in.

#1 2011-01-12 15:19:34

eduardo.eae
Member
From: Reconquista - Argentina
Registered: 2010-01-24
Posts: 71

[SOLVED] DWM's status bar doesn't change after suspend.

As the title says, the status bar works fine until I suspend my laptop. When it resumes the status bar doesn't change/update anymore. If I restart dwm it works again, but I suspend it a lot and can't be restarting dwm with a lot of windows all the time.
Tried with xsetroot -name "$SOMETHING" and with dwmstatus (a C program that display some info and doesn't require xsetroot) and got same result.
Anyone came across this??

DWM: 5.8.2-2 with some patches but no one regarding the bar. Also tried dwm-sprinkles and got same result.
Xorg-server: 1.9.3.901-1 (manually compiled to remove stuff I don't need) and intel driver form testing
Kernel: 2.6.37 (Manually compiled).

Last edited by eduardo.eae (2011-01-12 16:40:46)

Offline

#2 2011-01-12 16:30:39

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] DWM's status bar doesn't change after suspend.

How do you start dwm? Do you use one of the methods here? I use statnot and just have:

statnot ~/.config/statnot/config.py &
exec dwm

in my ~/.xinitrc. I used to use a dwm-start script (used instead of exec dwm in .xinitrc) that looked like:

#!/bin/sh
~/scripts/dwm-status | while true;  do  /usr/bin/dwm > /dev/null; done;

Where dwm-status was like:

#!/bin/sh
function netstatus {
eth=`ifconfig|grep eth0`
wlan=`ifconfig|grep wlan0`
status=`ping -qc1 google.com 2> /dev/null`
if [ -n "$status" ]; then
    if [ `ifconfig|grep wlan0|wc -l` -ne "0" ]; then
        link=wlan0;
    elif [ `ifconfig|grep eth0|wc -l` -ne "0" ]; then
        link=eth0;
    fi
else
    link=down;
fi
sshstatus=`ps aux|grep 'ssh -f'|wc -l`
if [ "$sshstatus" -ge 2 ]; then
    sshstatus='S'
else
    sshstatus='\x02S\x01'
fi
}

function netspeed {
#
# displays download / upload speed by checking the /proc/net/dev with
# 2 second delay
#
netstatus
if [ "$link" == "down" ]; then
    echo -e "\x02Network Down\x01"
    exit 1
fi

old_state=$(cat /proc/net/dev | grep ${link})
sleep 1
new_state=$(cat /proc/net/dev | grep ${link})

old_dn=`echo ${old_state/*:/} | awk -F " " '{ print $1 }'`
new_dn=`echo ${new_state/*:/} | awk -F " " '{ print $1 }'`
dnload=$((${new_dn} - ${old_dn}))

old_up=`echo ${old_state/*:/} | awk -F " " '{ print $9 }'`
new_up=`echo ${new_state/*:/} | awk -F " " '{ print $9 }'`
upload=$((${new_up} - ${old_up}))

d_speed=$(echo "scale=0;${dnload}/1024" | bc -lq)
u_speed=$(echo "scale=0;${upload}/1024" | bc -lq)

echo -e -${d_speed}k +${u_speed}k "$sshstatus"
}

function topproc {
    echo "`ps -e -o pcpu,args --sort pcpu | tail -1| sed 's/\/.*\///g' |awk '{print $2" "$1}'`"
}

function memory {
    USED=`free -m | awk '$1 ~ /^-/ {print $3}'`
    TOTAL=`free -m | awk '$1 ~ /^Mem/ {print $2}'`
    echo "100*$USED/$TOTAL" | bc
}

function diskuse {   ## Usage - diskuse {mount point}
    USED=`df -hP|grep $1|awk '{print $5}'|sed 's/\%//'`
    echo "$USED"
}

function mailcount {
    m=`ls ~/mail/INBOX/new|wc -l`
    if [ "$m" == "0" ]; then
        echo "::"
    else
        echo -e ":: \x02Mail\x01::"
    fi
}
function weather { ## Only print .weather if network is up. Weather.sh is run by cron
netstatus

if [  "$link" == "down" ]; then
    echo "Weather N/A"
    exit 1
else
    cat ~/.weather|head -1
fi

}    
function batt {
    perc=`acpi | awk '{print $4}'|sed 's/,//'`
    state=`acpi | awk '{print $3}'`
    if [ "$state" = "Discharging," ]; then
        echo -e "\x02$perc\x01"
    else
        echo "$perc"
    fi
}

function music {  ## Print currently playing artist
    tmp=`mpc |grep "\[playing\]" | wc -l`
    if [ "$tmp" == "1" ]; then
        vis=`mpc current | awk -F "-" '{print $1}'`
        echo ":: $vis"
    fi
}

function date_mute {  # Print Date, Time. Highlight it all if volume is muted
    d=`date +'%a %d %b %H:%M'`
    vol=`amixer|head -n6|tail -n1|awk '{print $7}'`
    if [ "$vol" = "[off]" ]; then
        echo -e "\x02$d\x01"
    else
        echo "$d"
    fi
}

while true
do
    xsetroot -name " $(topproc) $(music):: $(netspeed):: M $(memory) :: / $(diskuse `mount |grep ' / '|awk '{print $1}'|sed -e 's/\/dev\///'`) :: $(batt)$(mailcount) $(weather):: $(date_mute) ::"
    sleep 4
done

And I've never had any problem with suspend/resume on my laptop.

Good luck!
Scott

Last edited by firecat53 (2011-01-12 16:31:31)

Offline

#3 2011-01-12 16:40:26

eduardo.eae
Member
From: Reconquista - Argentina
Registered: 2010-01-24
Posts: 71

Re: [SOLVED] DWM's status bar doesn't change after suspend.

5 days struggling with this and after I post here I found the problem...
It is all thanks to a patch "dwm-r1525-warp.diff". I removed it and all works properly now.
Thanks anyway.

Offline

Board footer

Powered by FluxBB