Sample Header Ad - 728x90

Best practice for generating bell/beep in a *n*x GUI-oriented program

3 votes
1 answer
325 views
I've managed to get myself into an argument elsewhere trying to discourage somebody from writing a library that invokes aplay in order to get a GUI program to make a simple noise: the sort of thing that on a text console would be done by \a My understanding is that ALSA as a subsystem is fairly pervasive, and libasound.so as a client library appears to be installed on any (Linux) host capable of running a GUI-oriented program even if it doesn't have a full desktop environment (i.e. a program relies on X11 tunnelled over SSH etc.). On the other hand, I notice https://www.gnu.org/software/emacs/manual/html_node/elisp/Desktop-Notifications.html which implies that at least Emacs is able to raise an audible alert via D-Bus, and it looks as though KDE's konsole does something similar although I've not yet looked inside the messages in detail. In those cases I don't know if it's possible to rely on the fact that there's a theme-selected default alert sound. I've not found anything equivalent using e.g. wmctrl. Does the community think that best practice would be to interface with ALSA via libasound, or is there in fact a better way using e.g. D-Bus or some other way of interceding with the desktop environment (Window Manager etc.)?
Asked by Mark Morgan Lloyd (359 rep)
Oct 23, 2020, 10:33 AM
Last activity: Oct 24, 2020, 12:00 PM