gxmessage/yaf-splash not displayed from script

Using applications, configuring, problems
Message
Author
jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

gxmessage/yaf-splash not displayed from script

#1 Post by jafadmin »

I have written a script that monitors the connection state of a VPN connection. It basically uses gxmessage to alert the user when the VPN tunnel drops.

I'm trying to call it from the "ip-up" script that automatically runs after vpn connects.

The problem is that the gxmessage doesn't display. The scripts are executing, and test code that prints out to a file from both scripts prints ok (echo "test text 3" >> /etc/ppp/test.out), but the gxmessages will not pop up on the user console.

What am I overlooking here?

Thanks in advance. I've been pulling my hair out for 6 hours on this so far ... :roll:

[Update]

WooHoo! 8) I figured it out! gxmessage needed the "-display :0" switch if you are not directly executing the script from the console.
Last edited by jafadmin on Sun 27 Apr 2014, 16:35, edited 2 times in total.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#2 Post by mikeb »

hmmm odd...but the really useful gxmessage was removed and I am not sure if it ever returned so it may be a hacky gtkdialog script as I use it from scripts all the time and never have had to add that parameter...or gtk has gone weird :D...or bash has gone weird? or we have gone weird....

Heres a copy of the 'real' gxmessage.

mike
Attachments
gxmessage.tar.gz
(30 KiB) Downloaded 126 times

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#3 Post by Karl Godt »

The DISPLAY=:0 switch is needed if the script is started before X is started , fx from /etc/init.d/ directory .

Otherwise if dropped into /root/Startup it will start after X has started , so would not need the DISPLAY variable being set .

X will export DISPLAY variable systemwide when started .

Code: Select all

if test -z "$DISPLAY"; then
export DISPLAY=':0'
fi

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#4 Post by jafadmin »

Great. Here we go again . . .

Ok, so I got this brilliant idea to use yaf-splash (gtkdialog-splash) instead of gxmessage because I can have the notice appear at the top-center of the screen and exit with a mouse-over.

Works great from the command line.
Works great in a script clicked from roxfiler.
works great in a script called from another script clicked by roxfiler.

Code: Select all

yaf-splash -bg green -placement top -timeout 5 -display :0 -text " Your text goes here . . . " 
It doesn't work when called from the ip-up script used by pppd. gxmessage does, though.

I don't get it. There has to be something with permissions or context or scope or something that I can't see.

all the vpn processes run as root. . . .

any ideas?

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#5 Post by mikeb »

Same reason I assume...its lauched before X... in this case you will need gtkdialog 4 options to see if you can use your display fix and hope that the awful yaf-splash script passes them on .... you could use the real yaf-splash but it does not support unicode which is why it should never have appeared in the first place.. :D

Perhaps if binaries were actually what they appear to be, puppy would be more fun to write for :D

mike

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#6 Post by jafadmin »

Please explain what you mean by "it's launched before X". I'm confused by this.

This script is run after the puppy user desktop is booted and visible. It runs when they choose to start a VPN session with Gpptp.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#7 Post by mikeb »

Ah ok ...though you still had the problem which karl referred to

mike

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#8 Post by jafadmin »

mikeb wrote:Ah ok ...though you still had the problem which karl referred to

mike
No, neither of these are situations where scripts are being run before X. This problem appears with puppy fully booted.

And in the gxmessage problem above, for whatever reason, you MUST put the display parameter in the command line or it won't display.

yaf-splash is the same utility that displays the "puppy saving" messages. Works great in that usage.

:?

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#9 Post by mikeb »

No clues...I guess puppy gets stranger.... yaf-splash was a standalone binary so you are dealing with a script and gtkdialog pretending to be it.

mike

User avatar
puppyluvr
Posts: 3470
Joined: Sun 06 Jan 2008, 23:14
Location: Chickasha Oklahoma
Contact:

#10 Post by puppyluvr »

:D Hello,
You could try launching your splash message via the rxvt -e switch.
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!

Puppy since 2.15CE...

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#11 Post by jafadmin »

mikeb wrote:No clues...I guess puppy gets stranger.... yaf-splash was a standalone binary so you are dealing with a script and gtkdialog pretending to be it.

mike
Haha. Ok, so on a lark I downloaded the source for yaf-splash and compiled it.

It works in the script. It only seems to do the one font though, or I'm not getting the syntax right for specifyimg a different one ...

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#12 Post by mikeb »

Oh you are dealing with horrible looking pixmap fonts rather than the nice true type ones of gxmessage ... perhaps puppy was not considered ugly enough when yaf-splash was introduced. ;)

hard to say how they are defined...depends on the aliases set...but the choice is small or large ugly.

mike

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#13 Post by jafadmin »

So I figured out that the compiled binary for yaf-splash is still in puppy in the
/usr/X11R7/bin directory. With a little goofing around with parameters I was able to get a halfway decent result with the following:

Code: Select all

/usr/X11R7/bin/yaf-splash -bg green -font "Monospace" -placement "top" -margin 15 -outline 0 -display :0 -timeout 5 -text " VPN Monitor is Running . . . " 
Maybe not as pretty as the gtkdialog version, but at least I can get it to run from the ip-up script with no problem.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#14 Post by mikeb »

Top marks for persistance.... I forgot there was a copy in there.

I remember now some scripts call it directly when the hacky gtkdialog script fails to perform

mike

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#15 Post by jamesbond »

yaf-splash was phased out not because it can only display pixmap fonts. In fact it can display scalable and TTF fonts easily. It was phased out because it doesn't support unicode.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#16 Post by mikeb »

. you could use the real yaf-splash but it does not support unicode which is why it should never have appeared in the first place.. Very Happy
yes did mention that ...just also mentioned that ugly fonts seemed to be the ones chosen.

It was unmaintained for years too iirc..... good choice.

mike

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#17 Post by jamesbond »

mikeb wrote:yes did mention that ...just also mentioned that ugly fonts seemed to be the ones chosen.
Ah I missed that part. In fact, it is quite straightforward to enable yaf-splash to work with UTF-8 string (I just did that). As for the font, it is not chosen, it's because X font is not configured properly (AFAIK Puppy already comes with Dejavu? - which is quite decent).
It was unmaintained for years too iirc..... good choice.
My historical knowledge of Puppy is quite weak since I joined when Puppy 2.x was already on the full swing; so I could be wrong here. But my guess is yaf-splash was chosen because early Puppies didn't include GTK at all (and yaf-splash only depends on xlib). The same reason that jwm was chosen.

As for maintenance - it is such a small code and its functionality is more or less fixed; it doesn't require maintenance or new feature :) I compiled yaf-splash 1.02 "as is" (no patch etc) on x86_64, and ARM, no changes needed.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#18 Post by mikeb »

yaf-splash was introduced around puppy 2.17 iirc, last of the 2 series . GTK2 has been in puppy since at least 1.08.
. In fact, it is quite straightforward to enable yaf-splash to work with UTF-8 string (I just did that)
wonder why thats was not done... perhaps because it required more than a bash script ?

Xdialog , gxmessage and gtkdialog were used and present before yaf splash. ...xmessage was retained rather than gxmessage cos it looked worse I assume.

So it was brought in when there were perfectly useable, visually pleasant tools, then thrown out again after many scripts were changed over and now there is a very hacky inefficient script to replace it and a series of confusing symlinks and a half hidden original binary.... all seems like a waste of peoples time thats all.

mike

jafadmin
Posts: 1249
Joined: Thu 19 Mar 2009, 15:10

#19 Post by jafadmin »

jafadmin wrote:So I figured out that the compiled binary for yaf-splash is still in puppy in the
/usr/X11R7/bin directory. With a little goofing around with parameters I was able to get a halfway decent result with the following:

Code: Select all

/usr/X11R7/bin/yaf-splash -bg green -font "Monospace" -placement "top" -margin 15 -outline 0 -display :0 -timeout 5 -text " VPN Monitor is Running . . . " 
Maybe not as pretty as the gtkdialog version, but at least I can get it to run from the ip-up script with no problem.
Well, this didn't survive a reboot. It worked for hours, then for some inexplicable reason, just quit after a reboot.

Now I can't get it to work from a LiveCD.

Weirdness. Absolute weirdness ... :shock:

My best guess is that pppd is altering the environment in some way that breaks yaf-splash.

If I just execute the ip-up script stand-alone, yaf-splash works as expected. If the ip-up script is executed by the pppd process, it doesn't.

I'm gonna take up radish farming.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#20 Post by mikeb »

I'm gonna take up radish farming.
its kinder on the hands compared to brussel sprouts....

mike

Post Reply