You are not logged in.

#1 2011-04-04 02:25:39

meatcar
Member
Registered: 2010-03-11
Posts: 18

[Solved] dwm xsetroot status loop stops working after a while.

Hi All,

Last night I made the jump from 2 years of xmonad to dwm, after having some annoying haskell update issues, and wanting to try out a WM written in a language I know. Everything was set up fine, explored the patches, fell in love with flextile, made everything familiar, and so on. What's been happening, though, is that the statusbar loop that updates the dwm status keeps on not working after a period of time. It's pretty annoying, since the time stops, and its pretty much a game-stopper. I would really hate to kill more time now, with exams coming up, on setting up a different wm, and checking my phone for time is too distracting.

I dont use a login manager, everything is started from my one and only tty. My macbook is pretty responsive, especially with the low-resource usage of dwm. The reason I have a separate script to echo the contents of the statusbar is to allow me to mess with the bar's contents and see imediate feedback.

Honestly, I've looked everywhere, and couldn't find anything to solve this. Also, it sucks dwm cant take a status bar from stdin... sad

Here is the relevant line from my .xinitrc

        while true; do xsetroot -name "`dwmstatus`"; sleep 1s; done &
        startdwm

here is the dwmstatus script.

#!/bin/sh 

sep="|"

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

netstr="N: $essid $bar $sep"

volstr="V: $(amixer get PCM | awk -F'[]%[]' '/%/ {if ($7 == "off") { print "MM" } else { print $2 }}' | head -n 1) $sep"

if acpi -a | grep off-line > /dev/null; then
    batstr="Bat. $( acpi -b | awk '{ print $4 " " $5 }' | tr -d ',' ) $sep"
else
    batstr=""
fi

datestr="$(date +'%a, %b %d %R')"

echo "$batstr $netstr $volstr $datestr"
sleep 1s

Here is the startdwm script

#!/bin/sh 

while true; do 
    case $1 in
        -q)
            # not log 
            dwm >/dev/null 2>&1
            ;;
        *)
            # Log
            dwm 2> ~/.dwm.log 
            ;;
    esac
done

Any help would be much appreciated. smile smile smile

EDIT: Forgot to mention when I Mod+Shift+Q close dwm, it restarts automatically with an updated status, but the bar is still unresponsive (i.e. time and volume dont change). Currently, I'm trying a longer update between iterations. We'll see if this takes us anywhere...

Last edited by meatcar (2011-04-05 04:26:15)

Offline

#2 2011-04-04 04:27:45

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: [Solved] dwm xsetroot status loop stops working after a while.

This isn't a solution to your problem, but have you considered piping conky into your statusbar?  It seems to me it would do everything you are wanting to do with your separate script, and it would probably use about the same resources.  I haven't had any trouble with it to date.


I laugh, yet the joke is on me

Offline

#3 2011-04-04 05:22:34

meatcar
Member
Registered: 2010-03-11
Posts: 18

Re: [Solved] dwm xsetroot status loop stops working after a while.

Sadly, one can't pipe the status command into dwm anymore. While i havent tried conky, I would still have to use xsetroot to display the output, and I would imagine a similar issue would occur.

Also, setting a longer wait time is not an option. At 4 seconds between iterations, my time still stops. Tomorrow, i'll try having a less complicated status bar... maybe that would work..

Offline

#4 2011-04-04 06:50:16

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [Solved] dwm xsetroot status loop stops working after a while.

Nothing leaps out at me, but you might try starting dwm like so:

 while true; do path/to/dwmstatus; sleep 1s; done &
startdwm

And including in your script:

xsetroot -name "$batstr $netstr $volstr $datestr"

(Note - you now only have one sleep call - in your start script).


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2011-04-04 13:47:12

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

Re: [Solved] dwm xsetroot status loop stops working after a while.

I use Statnot and start it like:

statnot ~/.config/statnot/config.py &
while true; do
        dwm > /dev/null 2>&1
done

My statnot/config and statusline.sh are in my sig. It works great -- plus you get statusbar notifications if you so desire. I'm not sure if this is what you were looking for, but I haven't had any problems with it. I've got a pretty extensive status bar script, too.

Scott

Offline

#6 2011-04-04 18:46:43

meatcar
Member
Registered: 2010-03-11
Posts: 18

Re: [Solved] dwm xsetroot status loop stops working after a while.

Oh man. Breakthrough. I tried firecat53's advice, but the status bar was still becoming unresponsive after a while. I figured, it's not xsetroot's problem, its dwm's, since my script is responsive, and xsetroot is responsive, so some loop in dwm stops getting the data from xsetroot. After recompiling dwm without any patches, the statusbar has been fully responsive for the past 20 mins, which is more than anything i've seen so far. Later tonight, i will scientifically deduce which patch is responsible for this mahem, and report back.

Thanks for the statnot advice. I've seen it before, but I was too inconvenienced to set it up. It was remarkably easy to do though. smile Also, jasonwryan, thanks for spotting the reduntant sleep call.. totally slipped my mind.

Offline

#7 2011-04-05 04:25:54

meatcar
Member
Registered: 2010-03-11
Posts: 18

Re: [Solved] dwm xsetroot status loop stops working after a while.

Mystery resolved. The culprit has been identified as the warp patch. Honestly, I don't know how, or why, but if I don't patch with warp, everything works. yikes

Thanks for everyone's help. smile

Offline

Board footer

Powered by FluxBB