Rename method and change default theme to __custom

This commit is contained in:
Kovid Goyal
2024-08-03 12:59:36 +05:30
parent 22bd1b911c
commit 5e809d2767
3 changed files with 11 additions and 5 deletions

View File

@@ -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 */
};

View File

@@ -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

View File

@@ -963,7 +963,9 @@ MP3 or WAV on macOS (NSSound).
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 <https://specifications.freedesktop.org/sound-theme-spec/latest/sound_lookup.html>,
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]