Search code examples
tmuxxterm

Cannot make bell character audible in terminal


How do I get the bell character to play audibly in my tmux session running in xterm?

I am testing if it's audible via sleep 5 && echo -e "\a" then changing focus of windows. I can see the flash but don't hear anything.

I've tried numerous things like these in my ~/.tmux.conf

setw -g monitor-activity on
set -g bell-action any
bind-key -n C-g run-shell "paplay /home/TheUser/beep.ogg"
set -g default-command "paplay /home/TheUser/beep.ogg"
set-hook -g pane-bell "run-shell 'paplay /home/TheUser/beep.ogg'"

Or in my .Xrdb

XTerm*bellIsUrgent:  true
XTerm*visualBell: true
XTerm*audibleBell: true
XTerm*bellVolume: 100
XTerm*bellCommand: /home/TheUser/bin/beep.sh
gnome.terminal.audible-bell: true

xterm version: XTerm(353)
tmux version: tmux 3.0a


Solution

  • This minimal setting worked for me to run a command that plays the bell when a ^G character is seen by tmux in a background window. In ~/.tmux.conf:

    set-option -g monitor-bell on
    set-hook -g alert-bell 'run-shell "paplay /home/TheUser/beep.ogg"'
    

    Tested on tmux 3.0a. A printf "\a" to the shell in a non-visible window causes tmux to run the command paplay and highlihts the window name in the status bar.