What triggers notifications of the form "Bell in session Shell" in KDE?

7

I'm running KDE on Debian Testing.

From time to time, programs running in a terminal (Konsole) trigger system notifications of the form "Bell in session Shell".

What triggers these notifications?

Note: I'm not asking how to disable them - I know there's an option to do so in Konsole -> Settings -> Configure Notifications. I'm asking what behaviour triggers them in the first place, with a view of possibly modifying some of the programs that trigger them to not trigger them, or to trigger them under different conditions.

HighCommander4

Posted 2015-05-20T19:46:32.200

Reputation: 531

Answers

7

I believe this is how konsole terminal emulator interprets bells.

Try to run in bash

sleep 3 && echo -e "\a"

Then switch to another app and wait 3 seconds.

Many many years ago when real terminals were connected to big computers, there was a special protocol called "escape sequences" to send commands to such terminals. There are sequences to change color, move to new line, or ring bell. First terminals were equipped with real bells to notify operator about some long-running task is ended.

Any modern terminal emulator (konsole, xterm, or real console when your are in text mode) simply emulates such terminal hence understands such sequences.

The TERM env. variable tells the name of emulated terminal. Some libs like ncurses then use termcap (or terminfo) file to find which sequence is used for what on this terminal.

user996142

Posted 2015-05-20T19:46:32.200

Reputation: 1 205

I tried this, but echo -e "\a" does not produce the notification. – HighCommander4 – 2015-05-20T20:34:24.717

It does not work when your terminal is active. Try sleep 3 && echo -e "\a", then switch to another app, and wait 3 seconds. – user996142 – 2015-05-20T20:38:22.863

Yep, that does it, thanks! So, if I understand correctly, the behaviour that triggers this notification is any program running in the terminal sending the character '\a' (ASCII code 7) to standard output/error? – HighCommander4 – 2015-05-20T20:55:06.290

Yes) But it may do it not directly, but using beep command from ncurses lib. Ncurses then reads termcap to find appropriate sequence for your termnial (konsole). This sequence is "\a". But some other terminal may have some different sequence. – user996142 – 2015-05-20T21:01:38.257

Thanks! I found the line in the source code of the program I was running that was doing the beep (it was doing fprintf(stderr, "\07")) and got rid of it. Things are much more peaceful now :) – HighCommander4 – 2015-05-20T21:04:06.830