WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Roberts - perhaps you know what to change in wbar.sh  (Read 4408 times)

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Roberts - perhaps you know what to change in wbar.sh
« on: May 21, 2009, 11:21:45 PM »
I've been breaking my pick the last few days trying to figure out how to maintain two instantiations of wbar one for DISPLAY=0.0 and one for DISPLAY=1.0. The only problem I have left is that when an update occurs all wbar processes are killed off but only one is restarted. Is there a way to restart wbar for both displays?

Code: [Select]
#!/bin/sh
cd "$HOME"
if [ $(awk '/icons:/{print $2}' "$HOME"/.desktop) == wbar ]; then
   WBARPID=$(pidof wbar)                                         
   [ -n "$WBARPID" ] && killall wbar
   wbar -bpress -config /usr/local/tce.wbar > /dev/null &
fi                                                       
~
big pc man

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Roberts - perhaps you know what to change in wbar.sh
« Reply #1 on: May 22, 2009, 12:41:16 AM »
I don't have a setup such as yours to try...
But does a pidof wbar on each separate display return only one and the correct one for that display?
If so then killall could be replaced with a kill of the specific returned pid.
10+ Years Contributing to Linux Open Source Projects.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: Roberts - perhaps you know what to change in wbar.sh
« Reply #2 on: May 22, 2009, 09:33:56 AM »
I don't have a setup such as yours to try...
But does a pidof wbar on each separate display return only one and the correct one for that display?
If so then killall could be replaced with a kill of the specific returned pid.
Thanks for the response. The pidof command does report both display wbars. However, since I start the display 1.0 wabr using /usr/bin/wbar I can differentiate the two instantiations in the ps output.

What I would prefer to do is restart both the wbars in the script so they are in sync using the DISPLAY command:

DISPLAY=:0.0 wbar
DISPLAY=:1.0 wbar

Would this work?

big pc man

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Roberts - perhaps you know what to change in wbar.sh
« Reply #3 on: May 22, 2009, 10:15:34 AM »
If that works then modify /usr/bin/wbar.sh and then make the modified file a .tce, perhaps wbar_multi.tce to overwrite the standard with your custom one.
10+ Years Contributing to Linux Open Source Projects.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: Roberts - perhaps you know what to change in wbar.sh
« Reply #4 on: May 22, 2009, 10:40:13 AM »
If that works then modify /usr/bin/wbar.sh and then make the modified file a .tce, perhaps wbar_multi.tce to overwrite the standard with your custom one.

I have changed the wbar script as shown below and it does fix the wbar restart problems. Both displays 0.0 and 1.0 are restarted and are in sync when new applications are added. Good news!
Now then I suppose there should be a test before restarting display 1.0 wbar to make sure it was active in the first place. Is there a way to start wbar such that ps can identify it was started for display 1.0?

Code: [Select]
#!/bin/sh
cd "$HOME"
if [ $(awk '/icons:/{print $2}' "$HOME"/.desktop) == wbar ]; then
   WBARPID=$(pidof wbar)
   [ -n "$WBARPID" ] && killall wbar
   DISPLAY=:0.0 wbar -bpress -config /usr/local/tce.wbar > /dev/null &
   DISPLAY=:1.0 wbar -bpress -config /usr/local/tce.wbar > /dev/null &
fi
big pc man

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Roberts - perhaps you know what to change in wbar.sh
« Reply #5 on: May 22, 2009, 10:56:52 AM »
Often I check if X is running by checking the existence of /tmp/.X11-unix/X0
Perhaps you can check to see if you have a /tmp/.X11-unix/X1
10+ Years Contributing to Linux Open Source Projects.

Offline mikshaw

  • Sr. Member
  • ****
  • Posts: 368
Re: Roberts - perhaps you know what to change in wbar.sh
« Reply #6 on: May 22, 2009, 11:09:32 AM »
A simpler solution might be to make a symlink to wbar with a unique name.  In that case the command name used by killall is the name of the symlink.

EDIT:  I see Lee has already mentioned that in this thread:
http://forum.tinycorelinux.net/index.php?topic=1637.0
« Last Edit: May 22, 2009, 11:12:23 AM by mikshaw »

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: Roberts - perhaps you know what to change in wbar.sh
« Reply #7 on: May 22, 2009, 11:16:28 AM »
Yes indeed  /tmp/.X11-unix/X1 exists when display 1.0 is active and yes I was thinking about the symlink idea as well.  I'll try the X1 test out.
big pc man

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: Roberts - perhaps you know what to change in wbar.sh
« Reply #8 on: May 22, 2009, 11:50:37 AM »
I have added the test for x11 on display 1.0 to the wbar.sh script and it now restarts the display1.0 wbar on updates.

Code: [Select]
#!/bin/sh
cd "$HOME"
if [ $(awk '/icons:/{print $2}' "$HOME"/.desktop) == wbar ]; then
   WBARPID=$(pidof wbar)
   [ -n "$WBARPID" ] && killall wbar
   DISPLAY=:0.0 wbar -bpress -config /usr/local/tce.wbar > /dev/null &
   [ -e /tmp/.X11-unix/X1 ] && DISPLAY=:1.0 wbar -bpress -config /usr/local/tce.wbar > /dev/null &
fi

Now I need the same arrangement for flwm so when updates happen they too will be synced up and restarted. I was hoping the refresh button in the menu would be good enough but it's not.
big pc man