No Terminal Bell
From: Fix missing keyboard bell in terminal on Ubuntu
"To fix this problem persistently:
Run gconf-editor and if the desktop | gnome | peripherals | keyboard | bell_mode
setting is present then change it from off to on
Add pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg
to the file ~/.xprofile
Add [ "$DISPLAY" ] && xset b 100
to the file ~/.bashrc
The simplest way to activate this solution is to reboot.
Adjust the Volume of the Terminal Bell
From: Pulseaudio - X11 Bell Events - ArchWiki
I found that Pulse Audio had no volume control for the terminal bell.
To adjust the volume of the X11 bell, run the following command:
xset b 100
Where 100 in the command is a percentage. So to set 50% volume you would run xset b 50
This requires the xorg-xset package.
I changed the line in ~/.bashrc to:
[ "$DISPLAY" ] && xset b 50
to bring the volume to a "normal" level but allowing me to raise it for special alerts after a command ends.
To implement this solution immediately for a terminal window that is already open, run the pactl command and run the xset command in the terminal window in question."
pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg
xset b 100
Changing the bell sound
I did not like the glass.ogg file that they used so I created a new sound file using sox:
sox -n bell.ogg synth 0.1 sine 300-3000 vol 0.005
in my home directory. I then changed the command in ~/.xprofile to:
pactl upload-sample ~/bell.ogg bell.ogg
to change the sound go to the home directory and run a sox command (like the one above) to create a new bell.ogg file. Then in the terminal to use the new sound run the:
pactl upload-sample ~/bell.ogg bell.ogg
command.
Alias beep and beep-vol
I also created two aliases (both in bash and fish)
beep and beep-vol.
beep can be used in scripts or to alert you when a task is finished
beep-vol can be used to set the terminal bell volume on the command line without remembering the xset b command. Just type beep-vol 50
to set the volume to 50%.
bash
You can add these to your ~/.bashrc or if you have a working ~/.bash_aliases file you can add them there.
alias beep="echo -ne '\007'"
alias beep-vol="xset b $1"
fish
You can save these as files in your ~/.config/fish/functions/ folder:
~/.config/fish/functions/beep.fish
function beep
echo -ne '\007';
end
~/.config/fish/functions/beep-vol.fish
function beep-vol
xset b $argv;
end
pactl load-module module-x11-bell display=:0.0 sample=bell.ogg
to make this work – Udi Jul 25 '12 at 05:03