New popup utility

I have always wanted to write a "popup" text-message utility from scratch, in C or BaCon, that is very efficient and does all of the various things that I would like a popup utility to do.

In Puppy and Quirky we have some popups that use gtkdialog, but I have always considered this to be less-than-satisfactory -- for example, 'yaf-splash' (gtkdialog-splash) and 'pupmessage').
There are others of course, such as xmessage, gxmessage, Xdialog, yad, etc. (and of course gtkdialog), most of which can do a lot more than simple information-popup, but are not really optimal for simple message-popup.

So, I have written one, named 'popup', in BaCon. It is written with HUG, with some GTK function imports and some embedded C. It runs as a daemon, that is, as a separate process, and once started you can optionally send more controls (commands) and text to it -- not by stdin or whatever, but by writing to a file.

I had originally thought that 'popup' could watch the file for modifications using inotify, but soon decided that is not suitable, for various reasons. Now, the GTK timer function is used, called every 500 msec, which is also convenient as a "terminate=<number>" control can be sent to tell it to quit after so many seconds.

Anyway, showing how it works by example, here is an invocation:
# ./popup "name=bk1 background='#00ffff' placement=top-middle|This text allows Pango Text Attribute Markup Language, for example <b>bold</b>, <big>big</big>, <small>small</small>, <i>italic</i>, <tt>monospace</tt>"

Which looks like:

Then this:
# echo "background='#ff0000' level=top flash=on writemode=append-newline|Now the message is on top layer and flashing, to draw attention" >> /tmp/popup_bk1

The popup comes to top layer and background flashes:

Then to terminate it:
# echo "terminate=now|" >> /tmp/popup_bk1

To find out all that it can do, just type "./popup" and hit ENTER key, or "-h" or "--help" then ENTER.

I have uploaded the source code to the BaCon forum:

I have placed popup into the Quirky build system, but it is a generic utility that will work in any Linux, including puppies.


popup fixes   Posted on 10 Mar 2014, 12:10 by BarryK
Ok, the code now tests if the image exists, if not, uses an "X".

Also, there was a bug parsing the fontname.

Have re-uploaded code and binary.

closebox   Posted on 9 Mar 2014, 19:43 by 01micko

This makes it Puppy specific! It would be nice if you could use a gtk widget.

I did try this once but it was bad, kept printing the label as well. A work around was to use the "X" char. Not pretty but worked.


code and binary uploaded   Posted on 9 Mar 2014, 8:41 by BarryK
I have uploaded the latest code and binary to my web site:

I added text-justification.

That's it, done, but might tweak a few things later.

count-up count-down   Posted on 9 Mar 2014, 2:22 by broomdodger
Please consider an option:

When count-down finishes, count-up starts.
Also count-up and count-down should be able to have different colors.

That will allow me to see how long it has been since I missed the count-down.


ok button   Posted on 8 Mar 2014, 18:33 by BarryK
I added an OK button:

# ./popup "name=bk1 background='#ffff00' placement=middle width=360 terminate=ok|This text allows Pango Text Attribute Markup Language, for example <b>bold</b>, <big>big</big>, <small>small</small>, <i>italic</i>, <tt>monospace</tt>"

Closebox, count up/down   Posted on 8 Mar 2014, 15:54 by BarryK
I have added a "closebox", by means of "terminate=closebox" control:

# ./popup "name=bk1 background='#ffff80' placement=top-middle width=-1 terminate=closebox|This text allows Pango Text Attribute Markup Language, for example <b>bold</b>, <big>big</big>, <small>small</small>, <i>italic</i>, <tt>monospace</tt>"

Which looks like this:

I have also added real-time count-up and count-down, in seconds or in "clock mode" (display minutes and seconds), by means of the "timecount" control. For example:

# ./popup "name=bk1 background='#ffff00' placement=top-middle width=-1|This text allows Pango Text Attribute Markup Language, for example <b>bold</b>, <big>big</big>, <small>small</small>, <i>italic</i>, <tt>monospace</tt>"

# echo "terminate=20 timecount=dn writemode=append-newline|Popup will terminate in <big><b><span color='#ff0000'>COUNT</span></b></big> seconds" >> /tmp/popup_bk1


The latter works by substituting the text "COUNT" wherever it is in the message, into the time, and updates it every second.

I plan to add some more features, then I will post the source and binary. I will probably post the binary without needing that separate "" library, for the convenience of others who might want to use this utility.

mere mortal woes   Posted on 7 Mar 2014, 19:11 by aarf
we mere mortals cant download attachments from that site

queued messages   Posted on 7 Mar 2014, 8:45 by BarryK
Significant improvement, see post in BaCon forum: