Can shell script pop up notification like this blue box in puppy linux? (This blue box appears when a video is opened in slacko7_64.)
Or, if not, is shell script able to produce any other kind of popup notification (when the script is running in background)?
Can shell script pop up system notification?
Moderator: Forum moderators
Can shell script pop up system notification?
- Attachments
-
- Screenshot.png (151.49 KiB) Viewed 1051 times
- rockedge
- Site Admin
- Posts: 6539
- Joined: Mon Dec 02, 2019 1:38 am
- Location: Connecticut,U.S.A.
- Has thanked: 2746 times
- Been thanked: 2620 times
- Contact:
Re: Can shell script pop up system notification?
I use gxmessage for notifications from a script. Something like
Code: Select all
gxmessage This is a message -font 16 -center -timeout 4
For more of a "technical retro" look try using :
Code: Select all
xmessage This is a message -center -timeout 6
For another way to generate notifications perhaps using dunst
might work, which would be a box like the example in the first post
-
- Posts: 357
- Joined: Mon Jul 13, 2020 6:14 pm
- Location: Germany, NRW
- Has thanked: 18 times
- Been thanked: 126 times
Re: Can shell script pop up system notification?
The blue box shown can be created with notify-send "This is a message"
Like rockedge, i often use xmessage
and sometimes yaf-splash
Re: Can shell script pop up system notification?
Nice to have these different options! Thanks!
xmessage/gxmessage works more like a traditional dialog box. By default, it needs to be closed. But there appears to be many other options available.
notify-send works just like the one in the screenshot I attached. It seems to be widely used for system notification in Linux in general, with facilities to format its text.
yaf-splash looks more like, well, a splash. Very interesting to have!
Re: Can shell script pop up system notification?
I noticed that notify-send messages can be closed by pressing ctrl+space. I checked jwm settings and did not find this shortcut. Is it a built-in feature of notify-send? Can it be modified?
- user1234
- Posts: 414
- Joined: Sat Feb 26, 2022 5:48 am
- Location: Somewhere on earth
- Has thanked: 155 times
- Been thanked: 90 times
Re: Can shell script pop up system notification?
Puppy uses dunst notification daemon. When you use notify-send it automatically calls dunst.
To modify any of its behaviour, you can use the graphical dunst settings editor of dunst, or else modify its configuration file manually.
I see that keyboard bindings can't be changed from the graphical dunst settings editor provided by puppy-linux. So for changing them, you'd have to modify the dunst configuration file manually.
In puppy, dunst config file is located at /root/.config/dunst/dunstrc.
I found dunst documentation for editing configurations here. You can go to the Keyboard shortcuts (X11 only) heading in the webpage.
PuppyLinux gives new life to old computers
- MochiMoppel
- Posts: 1232
- Joined: Mon Jun 15, 2020 6:25 am
- Location: Japan
- Has thanked: 21 times
- Been thanked: 437 times
Re: Can shell script pop up system notification?
At least in older Puppies it may not work, e.g. doesn't work in Slacko 5.6 and isn't even installed in Lupu 5.2.8.
When gxmessage is configured without buttons it may look almost like notify-send. Close with ESC key or wait for the optional time-out:
Code: Select all
gxmessage -bo -c -tim 5 -fn 'bold 10' -bg '#285577' -fg '#FFF' -bu '' $'\n\n A buttonless gxmessage'
Related topic:
How to pop-up boxes and notifications from scripts?
- Attachments
-
- gxmessagebox.png (30.86 KiB) Viewed 955 times
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Can shell script pop up system notification?
MochiMoppel wrote: ↑Wed May 25, 2022 6:27 amWhen gxmessage is configured without buttons it may look almost like notify-send. Close with ESC key or wait for the optional time-out:
Code: Select all
gxmessage -bo -c -tim 5 -fn 'bold 10' -bg '#285577' -fg '#FFF' -bu '' $'\n\n A buttonless gxmessage'
Thanks. Very handy
- greengeek
- Posts: 1383
- Joined: Thu Jul 16, 2020 11:06 pm
- Has thanked: 534 times
- Been thanked: 192 times
Re: Can shell script pop up system notification?
HerrBert wrote: ↑Wed May 25, 2022 7:51 amyaf-splash can be customized by command...
Code: Select all
yaf-splash -timeout 8 -bg_gradient false -bg steelblue4 -fg white -margin 16 -fontsize 11 -align left -placement bottom-right -text $'yaf-splash message looking\nlike a notification'
Thanks. Archived for later use... cheers!
Re: Can shell script pop up system notification?
The ~/.config/dunst/dunstrc works after killing dunst. (It does not need to be manually restarted, as notify-send seems to call it.)
However, trying to configure dunst in terminal failed, with the errors:
Code: Select all
# dunst -key ctrl+space
WARNING: BadAccess (attempt to access private resource denied)
WARNING: BadAccess (attempt to access private resource denied)
WARNING: Unable to grab key 'ctrl+grave'.
CRITICAL: Cannot acquire 'org.freedesktop.Notifications': Name is acquired by 'dunst' with PID '5618'.
Edit:
Well, just after posting this, I realized that configuring dunst in terminal also requires killing it first. This works:
Code: Select all
pkill dunst
dunst -key ctrl+space &
- mikewalsh
- Moderator
- Posts: 6154
- Joined: Tue Dec 03, 2019 1:40 pm
- Location: King's Lynn, UK
- Has thanked: 792 times
- Been thanked: 1979 times
Re: Can shell script pop up system notification?
Personally, I make a lot of use of either gxmessage or gtk-dialog/box_splash for notifications.
I have all Puppies set-up - via custom scripting - to create a back-up of the PuppyPin file prior to passing control back to wmpoweroff/wmrestart. As part of this, a gxmessage box pops-up to let me know that file has been copied. Having to manually close it is fine, because the shut-down/re-boot process won't go any further until I do. Keeps me aware of what's happening, and I'm SO used to it, it's just part of my normal shutdown routine by now.
A menu entry under Menu->Desktop allows me to reset things very quickly & easily, along with an auto-restart of 'X', in the now unlikely event that PuppyPin goes AWOL.
(I had a spell, a few years back, when most Puppies seemed to "lose" their PuppyPin file on a regular basis, so I cobbled this stuff together to make sure that never happened again. It's a right PITA having to set your desktop up again at every boot, especially when they're as highly-customized as mine are.
It was around the same time that I realized the PuppyPin file was "dynamic", i.e., it reflected changes immediately, in real-time, as you made them.....so it really DID keep the thing 'up-to-date' on every shutdown. )
-------------------------------
@HerrBert / @MochiMoppel :-
Thanks for the info about yaf-splash & the "buttonless" gxmessage, guys. Nice to have further options!
HerrBert:- Is yaf-splash standard with Puppies, or does it need installing? (EDIT:- Answered my own question. Seems it's a sym-link to gtk-splash.)
Cheers.
Mike.
- MochiMoppel
- Posts: 1232
- Joined: Mon Jun 15, 2020 6:25 am
- Location: Japan
- Has thanked: 21 times
- Been thanked: 437 times
Re: Can shell script pop up system notification?
I'm not @HerrBert ,but let me answer anyway because it's more complicated than you think.
yaf-splash is a tiny 25K binary written by John Morton in 2003 and was included in all Puppies up to 4.xx , usually in the directory /usr/X11R7/bin. Many scripts used it for splash messages.
In 2010 forum member mave posted a little script, named gtkdialog-splash that was supposed to mimick the original yaf-splash, though it still lacked many of the original's options.It remains unclear, why he felt a need to replace yaf-splash but the idea sparked the interest of other members who subsequently added more options.
In the following Golden Age of rock solid Puppies (Lupu, Slacko 5.x etc.) gtkdialog-splash was added to /usr/bin, together with a symlink named - you guessed it - yaf-splash. The original binary was left in /usr/X11R7/bin, probably for nostalgic reasons.
With the advent of woofCE the directory /usr/X11R7 was discarded, together with the yaf-splash binary. The gtkdialog-splash script was replaced by /usr/lib/gtkdialog/box_splash and gtkdialog-splash turned into a mere wrapper script for box_splash. Box_splash claims to be "compatible with yaf-splash" - which it is not.
Fast forward to 2021: yaf-splash is back as a binary in /usr/bin in @BarryK's EasyOS. BK explained the reason in this blog post. I'm not sure why he replaced all references to yaf-splash with references to gtkdialog-splash. IMHO yaf-splash has clear advantages over gtkdialog-splash.
The weak point of gtkdialog-splash, apart from its slowness, is its inability to splash a message "always-on-top" other windows, but this ability is crucial for alert messages. Here is where yaf-splash excels. It pops up on top of fullscreen windows and even keeps on top after a new "layer above" window tries to cover its area. It simply can't be covered by windows or trays.
The real yaf-splash has weak points too. It is Unicode agnostic and the syntax for the -font option can be very tricky but without customizing the font the message tends to look very ugly. It seems to run fine in other 32bit distros (I "borrowed" a copy from my Slacko 5.6 and placed it into Xenial 7.5 and it worked).
Here the usage info. Note the interesting and partly odd options:
Code: Select all
Usage: yaf-splash [ options ]
Where options include:
-text Message to display.
-timeout How long to display the message before
exiting. Default is 0, which means forever.
-clock Enable clock display.
-12 Display twelve hour time (default).
-24 Display twenty-four hour time.
-seconds Display seconds (default).
-noseconds Don't display seconds.
-countdown <date> Display a countdown instead of a clock.
Run `-countdown foo' to see date syntax.
-countdownquit Quit after the countdown has reached
zero (default).
-nocountdownquit Keep counting after reaching zero.
-geometry <geometry> Size and position of window.
-placement <placement name> A screen location, one of center, top,
bottom, right, left, top-right, top-left,
bottom-left, bottom-right. Defaults to center.
A specified placement will override -geometry.
-font <font> Name of an X font to use.
-transparent Make the window background be transparent,
if possible.
-nontransparent Don't (default).
-mirror Flip the text about the y axis. Useful for
back projection.
-nomirror Don't (default).
-fg Set the forground text colour (default: black).
-bg Set the background colour (default: white).
-bd Set the border colour (default: black).
-bw Set the border width (default: 2).
-outline Set the text outline width (default: 1).
-margin Set the margin size (default: 0).
I think it's best to regard yaf-splash and gtkdialog-splash as 2 distinctly different tools, each with its own cons and pros.
- Attachments
-
- The first 2 examples don't use -font option.
3rd example uses -font "-*-dejavu sans-bold-r-normal-*-24-0-100-0-p-0-*-*" - yaf-splash-examples.png (11.63 KiB) Viewed 1043 times
- The first 2 examples don't use -font option.
- mikewalsh
- Moderator
- Posts: 6154
- Joined: Tue Dec 03, 2019 1:40 pm
- Location: King's Lynn, UK
- Has thanked: 792 times
- Been thanked: 1979 times
Re: Can shell script pop up system notification?
@MochiMoppel :-
Thanks for the clarifications & explanations. That's very much appreciated.
I had no idea there were quite so many notification options available to us.....or have been, over the years. As you say, they all appear to have their good & bad points.
I've seen many references to yaf-splash over the years, but never really investigated further; my own needs were always covered by gxmessage and gtkdialog/box_splash.
Cheers.
Mike.