I know there is such a thing as a visual bell in Vim that makes the whole screen flash instead of beeping. Several terminal programs also have the same feature.
I'm looking for a similar type of visual bell that will flash all of my screens, on all of my virtual desktops, in X. I've only got headphones at work and my pc speaker is too quiet, so I need some other notification method that will definitely get my attention.
Does anyone know if it exists?
I don't of anything exactly like that, but you can use the command line tool notify-send to have pop-ups on the desktop. In Ubuntu the package is libnotify-bin. For example:
I had the same problem so I wrote a program for this:
https://github.com/rianhunter/xvisbell
To run:
Hope that helps.
Depending on what you need, there is also
xmessage
—it's old, it's ugly, but it's included with X. It doesn't flash the screen, but it will pop up a message, and you can specify what buttons are on it (which one you press is returned in the exit status) if that's important.You didn't specify GNOME or KDE, but KDE 4.2 has built-in support for this. If you look under System Settings > Accessibility, you can turn on the visual bell there. KDE also lets you customize actions for various system notifications that go beyond sounds. For example, you can show a popup, run a command, mark a taskbar entry, etc. This is under System Settings > System Notifications.
Yes, this is possible!
The following is an implementation that dims your monitor's LCD backlight and then brings it back to where it was.
Step one: find a way to reliably alter your backlight [1][2]. I'll use the simplest one here but ymmv.
There are kernel(?)-level controls in /sys/class/backlight. The exact subdirectory name will vary based on your setup. I'm using this method in this example, but if you find another command that works, you can skip step two and alter the script in step three to have the
get_brightness
andset_brightness
functions use your chosen method.This will give you your current brightness level
Now try changing it:
This should make your screen darker for one second and then bring it to level 80 (use the value you got earlier or else your display may be too dark). I've bundled them into the same command so you don't get stuck with a screen that is too dark. In this test, we're acting as root. We'll get access for your own account next. (Stop here if it doesn't work!)
Step two: get access for your own account:
(Note, this might not survive rebooting. I'll come back and revise this if that's the case, but I only reboot ~quarterly, so bear with me.)
Step three: write a script like the following:
You should be good to go. Save that as
/usr/local/bin/visual-bell
and make it executable (chmod +x visual-bell
), then you can run it. This script will blink the given number of times (defaults to one), so you can runvisual-bell 3
to blink three times.You can theoretically blink multiple monitors if you use
/sys/class/backlight/*/brightness
but beware that different monitors may have different brightness scales. My Dell LCD (connected via a DisplayPort-VGA adapter) does not work here, though my laptop display does.Further steps: Install as the "sound command" in programs like pidgin. I do not know how to do this in terminal emulators.
I am surprised no one has even mentioned ansi escape characters. How about this (perhaps one of the cleaner solutions for a visual bell):
and done. :)
if you want to make a little method out of it, then just put the following in your bashrc/zshrc/whateverrc:
Now, your terminal will flash you when you put it at the end or long commands ... like
sudo pacman -Syu; vflash
;sudo apt-get update && sudo apt-get dist-upgrade; vflash
; etc.If you want it to keep flashing you (muweheheh):
NOTE1: This doesn't work in tmux or screen. :'(
NOTE2: This information was retrieved from Wikipedia: Ansi Escape Codes and modified. Read up! It's good stuff; I promise. :)
NOTE3: The ansi escape codes used are
\x1b
. In most linux-based OSs, you can use\e
, but I always end up using\x1b
because it works on OS X as well (even though I don't use OS X and never will).Keep it simple - try this:
xrefresh -solid green
Feel free to repeat the command multiple times (perhaps even using different colors) to make your visual bell more impressive ... ;-)
You could use something like Zenity to show an alert dialog, or perhaps even a notification area item. You could also use dzen or xmsgd if you want something text-based. Note that none of these 'flash the screen' though.
Depending on the nature of the event and what desktop environment you are using, Specto might work for you.
A tool called
xcalib
can invert video. Inverting twice achieves the visual bell effect. Here's the little snippet of code to do that.