2

Is there a Linux command that makes the screen blink for a fraction of a second? Possibly on all virtual desktops?

I would use it to get a visual feedback to signal the end of a build, something like:

$ make; blink

I already tried with the beep command, to get an audio feedback, but on my system it produces no sound.

5
  • (1) "Possibly on all virtual desktops" -- You do not mean virtual terminals, you mean GUI desktops, right? What is your desktop environment then? (2) Why the gnu-screen tag? Sep 7, 2023 at 10:29
  • 3
    Possibly XY problem. Linux desktops support notifications; see notify-send. Sep 7, 2023 at 10:36
  • @KamilMaciorowski, yes, I mean GUI desktops. I am using KDE.
    – Pietro
    Sep 7, 2023 at 10:44
  • You can either send a notification to your DE, or use a terminal that supports a "visual" bell.
    – Panki
    Sep 7, 2023 at 12:10
  • GPIO pin driving a solenoid, which shakes a flaky, dollar-store HDMI cable close to the connector!
    – Kaz
    Sep 8, 2023 at 7:23

3 Answers 3

3

You could use something like xdotool to lower and then raise the brightness of your monitor. These commands are listed on a linuxhint query-

xdotool key XF86MonBrightnessUp
xdotool key XF86MonBrightnessDown

You could set your "blink" to be an alias for lowering the brightness, waiting something like a second, then re-raising it.

3

Since you are using KDE, you should check out the built-in Konsole (the terminal emulator) feature that notices when activity stops:

to monitor changes in a log or any other file, check the View menu and its Monitor for Activity/Silence options. Selecting this will allow Konsole to alert you via desktop notifications when something happens (or stops happening) in the tab for which you enabled the option

As with any other KDE application, you can choose the type of notifications for Konsole. You'll find the dialog under Settings > Configure Notifications.

See under Working With Files and Commands (a makeuseof.com article). You should be able to choose a "visual bell" as it is in the Konsole api.

Alternatively, if using X11, not Wayland, you can play with the display output:

xset dpms force off; sleep 1; xset dpms force on
1

You can configure your Putty terminal (ex: https://unix.stackexchange.com/a/306432/27616) (or others terminals) to have this "visual bell" instead of (or in addition to) the regular bell, and trigger it by printing a 'bel' :

printf '\07'
4
  • 1
    I do not have a Putty terminal. I would like to do it from a bash terminal. The printf '\07' command is recognized, but it does nothing.
    – Pietro
    Sep 7, 2023 at 14:05
  • A "bash terminal" is a terminal - such as PuTTY - running an instance of bash. If you're not using PuTTY you ought to say which terminal application you're using, because it's that which will implement flash instead of a sound when sent the ASCII "BEL" code (0x07) Sep 7, 2023 at 16:58
  • @roaima - Isn't Bash a terminal application?
    – Pietro
    Sep 11, 2023 at 14:27
  • 1
    @Pietro bash is a shell (application) that can run in a terminal (but doesn't have to). It is responsible for taking your commands, executing them, and returning the results. The terminal (tool) is responsible for the interface between software - often a shell - and you. For example, bash interprets printf '\07' to mean "send an ASCII BEL character to the output". The terminal understands "if I receive an ASCII BEL character from a program, make a sound". It's the second part that seems not to be working in your situation Sep 11, 2023 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .