You are not logged in.

#1 2011-11-09 17:26:08

LordOfInsomnia
Member
Registered: 2011-10-13
Posts: 69

[SOLVED]dwm won't update status bar

I have tried
https://wiki.archlinux.org/index.php/Dw … _statusbar
and it does not work.
I have tried ~/.xinitrc and ~/.Xclients, and it just does not work...

I am using gdm as display manager.

These are few lines which I added.

 
while true; do
   xsetroot -name "$( date +"%F %R" )"
   sleep 1m    # Update time every minute
done &
exec dwm

When I use

 
xsetroot -name "$( date +"%F %R" )"

in terminal status bar is updated.

Can someone help?
Thanks. smile

Last edited by LordOfInsomnia (2011-11-12 15:13:38)

Offline

#2 2011-11-09 17:45:56

stlarch
Member
From: hell
Registered: 2010-12-25
Posts: 1,265

Re: [SOLVED]dwm won't update status bar

See the wiki for GDM and xprofile. Maybe that will help.

Offline

#3 2011-11-09 18:08:47

LordOfInsomnia
Member
Registered: 2011-10-13
Posts: 69

Re: [SOLVED]dwm won't update status bar

I did find anything.
Which display manager do you use?

Offline

#4 2011-11-09 20:47:53

LordOfInsomnia
Member
Registered: 2011-10-13
Posts: 69

Re: [SOLVED]dwm won't update status bar

When i execute code

 
while true; do
   xsetroot -name "$( date +"%F %R" )"
   sleep 1m    # Update time every minute
done

from terminal, status bar is updated...
As soon as I terminate terminal, update of status bar is over. This part I understand. smile

Last edited by LordOfInsomnia (2011-11-09 20:58:31)

Offline

#5 2011-11-09 20:50:39

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

Re: [SOLVED]dwm won't update status bar

I have no idea how GDM works, but I would hazard a guess that your fix will involve working around that...

There is a section in the wiki on creating your own .desktop file, have you tried that?

# edit: also, please use \[code\] tags - it makes it easier to read what you are posting

Last edited by jasonwryan (2011-11-09 20:51:24)


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2011-11-09 21:05:07

LordOfInsomnia
Member
Registered: 2011-10-13
Posts: 69

Re: [SOLVED]dwm won't update status bar

@Jason I have fixed my posts smile

I have tried
http://www.guldmyr.com/blog/dwm-start-u … n-manager/

/usr/share/xsessions/dwm.desktop

[Desktop Entry]
Encoding=UTF-8
Name=dwm
Comment=This session starts dwm
Exec=/usr/local/bin/dwm-start
Type=Application

/usr/local/bin/dwm-start

#!/bin/sh
while true; do
   xsetroot -name "$( date +"%F %R" )"
   sleep 1m    # Update time every minute
done

Offline

#7 2011-11-09 21:17:15

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

Re: [SOLVED]dwm won't update status bar

Short of recommending that, if you really want to run dwm, you uninstall GDM - then all I've got is:

i) don't use the name dwm in the desktop file: try dwm-los or something so that GDM definitely picks up the correct file
ii) execute dwm from the start script


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2011-11-11 20:29:50

LordOfInsomnia
Member
Registered: 2011-10-13
Posts: 69

Re: [SOLVED]dwm won't update status bar

I dont use GDM any more, I have switched to CDM. Still I cannot update status bar from ~/.xinitrc.

I have made bash script which updates status bar for me...
What am I doing wrong?

Offline

#9 2011-11-11 20:52:51

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

Re: [SOLVED]dwm won't update status bar

Paste your .xinitrc and the statusbar script (and your dwm-start script if you use one).


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#10 2011-11-11 21:24:58

LordOfInsomnia
Member
Registered: 2011-10-13
Posts: 69

Re: [SOLVED]dwm won't update status bar

~/.xinitrc

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

#exec gnome-session
#exec startkde
#exec startxfce4
# ...or the Window Manager of your choice

while true; do
   xsetroot -name "$( date +"%F %R" )"
   sleep 1m    # Update time every minute
done &
exec dwm

I think

 exec dwm 

is not needed here.

updateStatusBar script

#while true; do
#  pack=`pacman -Qu | wc -l`
#  sleep 1
#done&
#this does not work

while true; do 
  pack=`pacman -Qu | wc -l`
  mem2=`grep MemFree /proc/meminfo | awk '{ print $2 }'`; 
  mem=$(( $mem2/1024 ));
  CLK=$( date +'%a %b %d %R:%S %Z' )
  xsetroot -name "|| $pack | $mem MB | $CLK ||"; 
  sleep 1; 
done&

I wanted to have two loops one with sleep 1h (for packeges), and one with sleep 1s (for time and memory), but i could not make it work.

I have also tried http://dwm.suckless.org/dwmstatus/
after

make clean install

i get this

fopen: No such file or directory

Same error is when I am trying  to start dwmstatus from compiled dir, file exists, but wont start...
This is new issue...

Offline

#11 2011-11-11 21:38:35

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

Re: [SOLVED]dwm won't update status bar

A couple of things:

  • if you are using cdm, then having that stuff in your .xinitrc won't be much help - put it in a start script

  • set the xroot window props once, either in your dwm-start script or your dwm status bar script - otherwise the conflict will cause you grief

  • just get the basic loop working before trying anything more complex

  • in your script, try using something like:

    dte(){
    	dte="$(date "+%I:%M")"
    	echo "$dte"
    }
    xsetroot -name "$(dte)"

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#12 2011-11-12 12:58:25

LordOfInsomnia
Member
Registered: 2011-10-13
Posts: 69

Re: [SOLVED]dwm won't update status bar

Thank you jasonwryan!

this is my .xinitrc

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

#exec gnome-session
#exec startkde
#exec startxfce4
# ...or the Window Manager of your choice

packeges()
{
  packeges="`pacman -Qu | wc -l`"
	if [ $packeges -eq 0 ]; then		
		echo ""
	else
  	echo " $packeges |"
	fi
}

mydate()
{ 
  datePart=$( date +'%d.%m.%Y' )  
  echo " $datePart |"
}

mytime()
{
  hh=$( date +'%H')
  mm=$( date +'%M')
  ss=$( date +'%S')
  if (( ( "$ss" % 2 ) == "0" )); then		
		timePart=( $hh:$mm:$ss )
	else
		timePart=( $hh" "$mm" "$ss )
	fi
	echo " $timePart |"
}

mymem2()
{
	mem2=`grep MemFree /proc/meminfo | awk '{ print $2 }'`  
  mymem2=$(( $mem2/1024 ));
	echo " $mymem2 MB |"
}


while true; do
   xsetroot -name "||$(packeges)$(mymem2)$(mydate)$(mytime)||"; 
   sleep 1
done &

exec dwm

But clock skips one second from time to time.
I think this is because of function "packeges", because lasts longer the one second.
How can i have two loops with different timings?

Last edited by LordOfInsomnia (2011-11-12 15:15:15)

Offline

Board footer

Powered by FluxBB