diff --git a/kitty/desktop.c b/kitty/desktop.c index 4a0939cf7..762835309 100644 --- a/kitty/desktop.c +++ b/kitty/desktop.c @@ -5,7 +5,7 @@ * Distributed under terms of the GPL3 license. */ -#include "data-types.h" +#include "state.h" #include "safe-wrappers.h" #include "cleanup.h" #include "loop-utils.h" @@ -249,9 +249,10 @@ play_canberra_sound(const char *which_sound, const char *event_id, bool is_path, } static PyObject* -play_desktop_sound(PyObject *self UNUSED, PyObject *args, PyObject *kw) { +play_desktop_sound_async(PyObject *self UNUSED, PyObject *args, PyObject *kw) { const char *which, *event_id = "test sound"; - const char *theme_name = "freedesktop"; + const char *theme_name = OPT(bell_theme); + if (!theme_name || !theme_name[0]) theme_name = "__custom"; int is_path = 0; static const char* kwlist[] = {"sound_name", "event_id", "is_path", "theme_name", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kw, "s|sps", (char**)kwlist, &which, &event_id, &is_path, &theme_name)) return NULL; @@ -277,7 +278,7 @@ finalize(void) { static PyMethodDef module_methods[] = { METHODB(init_x11_startup_notification, METH_VARARGS), METHODB(end_x11_startup_notification, METH_VARARGS), - {"play_desktop_sound", (PyCFunction)(void(*)(void))play_desktop_sound, METH_VARARGS | METH_KEYWORDS, ""}, + {"play_desktop_sound_async", (PyCFunction)(void(*)(void))play_desktop_sound_async, METH_VARARGS | METH_KEYWORDS, ""}, {NULL, NULL, 0, NULL} /* Sentinel */ }; diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index e6d2f13b5..cc5591440 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -556,6 +556,7 @@ def dbus_send_notification( urgency: int = 1, replaces: int = 0, category: str = '', + muted: bool = False, ) -> int: pass @@ -572,6 +573,7 @@ def cocoa_send_notification( categories: tuple[MacOSNotificationCategory, ...], image_path: str = '', urgency: int = 1, + muted: bool = False, ) -> None: pass @@ -1699,6 +1701,7 @@ def monotonic() -> float: ... def timed_debug_print(x: str) -> None: ... def opengl_version_string() -> str: ... def systemd_move_pid_into_new_scope(pid: int, scope_name: str, description: str) -> str: ... +def play_desktop_sound_async(name: str, event_id: str = 'test sound', is_path: bool = False, theme_name: str = '') -> str: ... class MousePosition(TypedDict): cell_x: int diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 925f9fc58..7aa391ebe 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -963,7 +963,9 @@ opt('linux_bell_theme', '__custom', ctype='!bell_theme', long_text=''' The XDG Sound Theme kitty will use to play the bell sound. -Defaults to the custom theme name used by GNOME and Budgie, falling back to the default freedesktop theme if it does not exist. +Defaults to the custom theme name specified in the +:link:`XDG Sound theme specification , +falling back to the default freedesktop theme if it does not exist. To change your sound theme desktop wide, create :file:`~/.local/share/sounds/__custom/index.theme` with the contents: [Sound Theme]