wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

Bell event triggers too much

Open darkgeem opened this issue 1 year ago • 0 comments

What Operating System(s) are you seeing this problem on?

Linux X11

Which Wayland compositor or X11 Window manager(s) are you using?

X11 with AwesomeWM as window manager

WezTerm version

20240812.215703.30345b36

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

Whenever a BEL character is being printed ('\a' / '\007' / '\x07'), the bells rings multiple times, I noticed it rings the exact same amount of times as the count of opened wezterm windows.

To Reproduce

  • open wezterm
  • run printf "\a"

Configuration

no config

Expected Behavior

The bell only rings once.

Logs

Debug Overlay
wezterm version: 20240812-215703-30345b36 x86_64-unknown-linux-gnu
Window Environment: X11 awesome
Lua Version: Lua 5.4
OpenGL: Mesa Intel(R) Graphics (ADL GT2) 4.6 (Compatibility Profile) Mesa 24.1.5-arch1.1
Enter lua statements or expressions and hit Enter.
Press ESC or CTRL-D to exit
03:07:50.080 ERROR wezterm_mux_server_impl::local > writing pdu data buffer: Broken pipe (os error 32)
03:07:50.114 INFO logging > lua: the bell was rung in pane 42 in window 27!
03:07:50.114 INFO logging > lua: the bell was rung in pane 42 in window 29!
03:07:50.115 INFO logging > lua: the bell was rung in pane 42 in window 28!
03:07:50.115 INFO logging > lua: the bell was rung in pane 42 in window 0!
03:07:50.116 INFO logging > lua: the bell was rung in pane 42 in window 25!
03:07:50.117 INFO logging > lua: the bell was rung in pane 42 in window 26!
03:07:50.117 INFO logging > lua: the bell was rung in pane 42 in window 30!

Anything else?

I added the following to log the bell occurrences, but the problem is the same whether or not I have a config file:

wezterm.on('bell', function(window, pane)
	_, _ = window, pane;
	wezterm.log_info(
		'the bell was rung in pane '
		.. pane:pane_id()
		.. ' in window '
		.. window:window_id()
		.. '!'
	);
end);

The problem isn't the audible bell, but the actual bell event, because both trigger the same amount of times.

My current workaround is to disable the builtin bell, and manually run the xkbbell command to trigger the X11 bell, but only if the window id is 0 (to avoid triggering multiple times):

wezterm.on('bell', function(window, pane)
	_, _ = window, pane;
	if (window:window_id() <= 0) then
		wezterm.background_child_process({
			'xkbbell'
		});
	end;
end);

darkgeem avatar Aug 18 '24 01:08 darkgeem