6

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.

6

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.

  • I tried this, but echo -e "\a" does not produce the notification. – HighCommander4 May 20 '15 at 20:34
  • 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 May 20 '15 at 20:38
  • 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 May 20 '15 at 20:55
  • 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 May 20 '15 at 21:01
  • 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 May 20 '15 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.