Skip to content

Instantly share code, notes, and snippets.

@tkurtbond
Created January 21, 2024 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkurtbond/bf7c6bc08b4d0758401b794f6b848b4b to your computer and use it in GitHub Desktop.
Save tkurtbond/bf7c6bc08b4d0758401b794f6b848b4b to your computer and use it in GitHub Desktop.
Set emacs up to ring the bell using an external program under Wayland, since the Wayland devs have something against the traditional bell supplied by Xbell.
(when (getenv "WAYLAND_DISPLAY")
(message "Running under Wayland")
(defvar tkb-beep-sound "/usr/share/sounds/freedesktop/stereo/bell.oga")
(defvar tkb-beep-program "ogg123")
(defun tkb-bell ()
"Ring the bell."
(interactive)
(start-process "Beep" nil tkb-beep-program
tkb-beep-sound))
(setq ring-bell-function #'tkb-bell)
(unless (file-exists-p tkb-beep-sound)
(yes-or-no-p (format "Error: tkb-beep-sound is set to \"%s\", which does \
not exist!\nUnderstand? "
tkb-beep-sound)))
(let ((path (split-string (getenv "PATH") ":")))
(unless (file-installed-p tkb-beep-program path)
(yes-or-no-p (format "Error: tkb-beep-program is set to \"%s\", which does \
not exist!\nInstall vorbis-tools! Understand? "
tkb-beep-program)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment