1

Thanks to chepner's answer here about visible bells

I have made an alias for apt-get {update,upgrade,dist-upgrade} to visually notify when the task is complete

apt-get update && apt-get upgrade && apt-get dist-upgrade ; printf '\e[?5h' ; read -p '' ; printf '\e[?5l' ;

But the problem is that it flashes the screen of only that terminal tab on which this alias is running.

So for instance, you are doing another work in another application or even in another tab of the same terminal, you would not be able to see the notification that the task is complete.

I have also turned gnome visual bell on

gsettings set org.gnome.desktop.wm.preferences visual-bell true

but how can I make the use of this visual bell provided by gnome in my script to notify me when the update, upgrade and dist-upgrade are all done.

If there are other visual bell options to integrate with scripts that flash the whole screen regardless of where I am in my PC when the job is done, please let me know.

Note: I am not looking for audible notifications.

1 Answers1

2

In graphics most notifications now use small popup windows, like with notify-send. If you prefer you can simply get a screenshot of the screen, negate the image with imagemagick, and present it for a fraction of a second:

xwd -root >/tmp/a.xwd
convert -negate /tmp/a.xwd /tmp/b.xwd
timeout .3 xwud -in /tmp/b.xwd

It will disrupt your input for a second, so you may lose a few typed characters and so on.

meuh
  • 51,383
  • Hi, nice idea, but a better idea I guess would be to have some script that brings me back to the shell screen on which the script is running. Check out this script I got from some answer a while ago, https://pastebin.com/fKWZ96fu , it detects the current shell, opens a new tab and exits the previous tab. Any idea on how to bring the active screen to focus when the task is complete? – GypsyCosmonaut Jul 06 '17 at 15:42
  • 1
    I don't have a gnome terminal to test with, but it might respond to the standard xterm control sequences to raise the window, printf '\e[5t', or to minimize and restore, printf '\e[2t'; sleep .5; printf '\e[1t'. You can also try commands like xdotool windowraise "$WINDOWID" if the terminal sets WINDOWID in your environment. – meuh Jul 06 '17 at 16:14
  • Thank you so much @meuh, just tested it on my system, works perfect, can the timeout line be replaced by some user input that until the user presses any key, hold this on the screen? – GypsyCosmonaut Jul 06 '17 at 20:08