13

There is an option in the Sound Preferences dialog, Sound Effects tab, to toggle Alert volume mute. It works and suffices for my needs to disable the irritating system beep/bell.

However, I reinstall systems a LOT for testing purposes and would like to set this setting in a shell script so it's off without having to fiddle with a GUI. But for the life of me I can't seem to find where this can be toggled via a command line tool.

I've scanned through gconf-editor, PulseAudio's pacmd, grepped through /etc, even dug through the gnome-volume-control source code, but I am not seeing how this can be set.

I gather that gnome-volume-control has changed since a few releases ago.

Ideas?

Bryce
  • 4,740

3 Answers3

13

Hunted for this for a long while. Especially since I do not use pulseaudio and I cannot mute the alert sound from the UI (WTF!?)

This does it. Oh the sweet joy of silence!

# gsettings set org.gnome.desktop.sound event-sounds false
6
  • Option 0: (this might be what you were looking for)

    sudo su gdm -c "gconftool-2 --set /desktop/gnome/sound/event_sounds --type bool false"
    
  • Option 1:

    Temporary:

    sudo modprobe -r pcspkr  
    

    Permanent

    echo “blacklist pcspkr” >> /etc/modprobe.d/blacklist
    
  • Option 2:

    Search for "set bell-style" in /etc/inputrc (options are none or visible)

  • Option 3:

    sudo mv -v /usr/share/sounds/ubuntu/stereo/*.ogg {*.disabled}
    
  • Option 4:

    man xset
    
0

I wrote a script that lets me adjust volume easily using the pacmd and pactl commands. Seems to work well when I'm using a GNOME desktop, (Wayland or Xorg), and it's working on RHEL/Fedora and Ubuntu so far. I haven't tried using it with other desktops/distros, or with surround sound systems, etc.

Drop it in your path, and run it without any values to see the current volume. Alternatively set the volume by passing it a percentage. A single value sets both speakers, two values will set left, and right separately. In theory you shouldn't use a value outside of 0%-200%, but the command will let you set the volume higher than 200%, which may harm your speakers, so be careful.

[~]# volume
L    R   
20%  20% 
[~]# volume 100% 50%
[~]# volume
L    R   
100% 50% 
[~]# volume 80%
[~]# volume
L    R   
80%  80% 
#!/bin/bash

[ ! -z "$1" ] && [ $# -eq 1 ] && export LVOL="$1" && export RVOL="$1" [ ! -z "$1" ] && [ ! -z "$2" ] && [ $# -eq 2 ] && export LVOL="$1" && export RVOL="$2"

SINK=$(pacmd list-sinks | grep -e '* index:' | grep -Eo "[0-9]*$")

if [ -z "$LVOL" ] || [ -z "$RVOL" ]; then

pacmd list-sinks | grep -e '* index:' -A 20 | grep -e 'name:' -e '^\svolume:.\n' -e 'balance' --color=none

printf "%-5s%-4s\n%-5s%-4s\n" "L" "R" $(pacmd list-sinks | grep -e '* index:' -A 20 | grep -e '^\svolume:.\n' --color=none | grep -Eo "[0-9]%" | tr "\n" " " | sed "s/ $/\n/g") exit 0 elif [[ ! "$LVOL" =~ ^[0-9]%$ ]] || [[ ! "$RVOL" =~ ^[0-9]*%$ ]]; then printf "The volume should specified as a percentage, from 0%% to 200%%.\n" exit 1 elif [ "$SINK" == "" ]; then printf "Unable to find the default sound output.\n" exit 1 fi

pactl -- set-sink-volume $SINK $LVOL $RVOL

ladar
  • 131