[dev] [dwm] terminating the status loop

2011-04-27 Thread Thomas Dahms

Hi list,

using something like

  while true; do
  xsetroot -name ...
  sleep 1
  done 
  exec dwm

in .xsession (I have to use KDM at work) as advertised in dwm's README  
leaves the background loop running even after logout, which has some ugly  
side effects: While not logged in, xsetroot floods the logs because it is  
unable to find the display. And logging back in, I have two loops running.


The following fixes the problem:

  while true; do
  xsetroot -name ...
  sleep 1
  done  statuspid=$!
  dwm 
  wait $!
  kill $statuspid

This looks quite ugly and I am curious if there is a more elegant way to  
terminate the status loop on logout.


--
Thomas Dahms



Re: [dev] [dwm] terminating the status loop

2011-04-27 Thread Kurt Van Dijck
On Wed, Apr 27, 2011 at 01:20:13PM +0200, Thomas Dahms wrote:
 Hi list,
 
 The following fixes the problem:
 
   while true; do
   xsetroot -name ...
   sleep 1
   done  statuspid=$!
   dwm 
   wait $!
   kill $statuspid
why not just:
dwm
kill $statuspid

I see no use in backgrounding dwm, and then waiting for it.
What did I miss?

Kurt Van Dijck



Re: [dev] [dwm] terminating the status loop

2011-04-27 Thread Thomas Dahms
On Wed, 27 Apr 2011 13:55:08 +0200, Kurt Van Dijck kurt.van.di...@eia.be  
wrote:



why not just:
dwm
kill $statuspid

I see no use in backgrounding dwm, and then waiting for it.
What did I miss?


Nothing; backgrounding dwm was left from trying a few other ways to do it.  
Thank you.

Then it can be simplified further:

  while true; do
  xsetroot -name ...
  sleep 1
  done 
  dwm
  kill $!

I wonder whether the README should be updated accordingly. But it is there  
for years and nobody seemed to notice before. I attach the trivial patch,  
just in case.


--
Thomas Dahms

example.patch
Description: Binary data


Re: [dev] [dwm] terminating the status loop

2011-04-27 Thread amann
 On Wed, 27 Apr 2011 13:55:08 +0200, Kurt Van Dijck kurt.van.di...@eia.be
 wrote:

 why not just:
  dwm
  kill $statuspid

 I see no use in backgrounding dwm, and then waiting for it.
 What did I miss?

 Nothing; backgrounding dwm was left from trying a few other ways to do it.
 Thank you.
 Then it can be simplified further:

while true; do
xsetroot -name ...
sleep 1
done 
dwm
kill $!


the following works for me:

while xsetroot -name $(date +%a, %b %d %Y | %H:%M)
do
sleep 20
done 
exec dwm

Andreas
 I wonder whether the README should be updated accordingly. But it is there
 for years and nobody seemed to notice before. I attach the trivial patch,
 just in case.

 --
 Thomas Dahms





Re: [dev] [dwm] terminating the status loop

2011-04-27 Thread Petr Sabata
On Wed, Apr 27, 2011 at 05:24:55PM +0200, am...@physik.tu-berlin.de wrote:
  On Wed, 27 Apr 2011 13:55:08 +0200, Kurt Van Dijck kurt.van.di...@eia.be
  wrote:
 
  why not just:
 dwm
 kill $statuspid
 
  I see no use in backgrounding dwm, and then waiting for it.
  What did I miss?
 
  Nothing; backgrounding dwm was left from trying a few other ways to do it.
  Thank you.
  Then it can be simplified further:
 
 while true; do
 xsetroot -name ...
 sleep 1
 done 
 dwm
 kill $!
 
 
 the following works for me:
 
 while xsetroot -name $(date +%a, %b %d %Y | %H:%M)
 do
 sleep 20
 done 
 exec dwm
 
 Andreas

That's quite nice.
I usually run a script instead of hardcoding the title in there...

  I wonder whether the README should be updated accordingly. But it is there
  for years and nobody seemed to notice before. I attach the trivial patch,
  just in case.
 
  --
  Thomas Dahms
 
 
 

-- 
Petr 'contyk' Sabata, Red Hat


pgp5jz4iqio6H.pgp
Description: PGP signature


Re: [dev] [dwm] terminating the status loop

2011-04-27 Thread Thomas Dahms

Hi Andreas,


while xsetroot -name $(date +%a, %b %d %Y | %H:%M)
do
sleep 20
done 
exec dwm


This is even nicer as the original instance of .xsession is not kept  
running.


--
Thomas Dahms



[dev] [dwm] terminating the status loop

2011-04-27 Thread Kurt Van Dijck
On Wed, Apr 27, 2011 at 05:51:27PM +0200, Thomas Dahms wrote:
 Hi Andreas,
 
 while xsetroot -name $(date +%a, %b %d %Y | %H:%M)
 do
 sleep 20
 done 
 exec dwm
 
 This is even nicer as the original instance of .xsession is not kept
 running.

I don't understand how the while loop terminates then when dwm terminates.

Kurt



Re: [dev] [dwm] terminating the status loop

2011-04-27 Thread Robert Ransom
On Wed, 27 Apr 2011 22:15:11 +0200
Kurt Van Dijck kurt.van.di...@eia.be wrote:

 On Wed, Apr 27, 2011 at 05:51:27PM +0200, Thomas Dahms wrote:
  Hi Andreas,
  
  while xsetroot -name $(date +%a, %b %d %Y | %H:%M)
  do
  sleep 20
  done 
  exec dwm
  
  This is even nicer as the original instance of .xsession is not kept
  running.
 
 I don't understand how the while loop terminates then when dwm terminates.

xsetroot fails (and returns a non-zero exit code) when the X server
terminates or becomes inaccessible.


Robert Ransom


signature.asc
Description: PGP signature


Re: [dev] [dwm] terminating the status loop

2011-04-27 Thread Kurt H Maier
On Wed, Apr 27, 2011 at 4:15 PM, Kurt Van Dijck kurt.van.di...@eia.be wrote:
 I don't understand how the while loop terminates then when dwm terminates.

xsetroot will return a nonzero exit code because the xserver is no
longer running.


-- 
# Kurt H Maier