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
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 11 additions and 5 deletions

View file

@ -5,7 +5,7 @@
* Distributed under terms of the GPL3 license. * Distributed under terms of the GPL3 license.
*/ */
#include "data-types.h" #include "state.h"
#include "safe-wrappers.h" #include "safe-wrappers.h"
#include "cleanup.h" #include "cleanup.h"
#include "loop-utils.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* 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 *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; int is_path = 0;
static const char* kwlist[] = {"sound_name", "event_id", "is_path", "theme_name", NULL}; 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; 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[] = { static PyMethodDef module_methods[] = {
METHODB(init_x11_startup_notification, METH_VARARGS), METHODB(init_x11_startup_notification, METH_VARARGS),
METHODB(end_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 */ {NULL, NULL, 0, NULL} /* Sentinel */
}; };

View file

@ -556,6 +556,7 @@ def dbus_send_notification(
urgency: int = 1, urgency: int = 1,
replaces: int = 0, replaces: int = 0,
category: str = '', category: str = '',
muted: bool = False,
) -> int: ) -> int:
pass pass
@ -572,6 +573,7 @@ def cocoa_send_notification(
categories: tuple[MacOSNotificationCategory, ...], categories: tuple[MacOSNotificationCategory, ...],
image_path: str = '', image_path: str = '',
urgency: int = 1, urgency: int = 1,
muted: bool = False,
) -> None: ) -> None:
pass pass
@ -1699,6 +1701,7 @@ def monotonic() -> float: ...
def timed_debug_print(x: str) -> None: ... def timed_debug_print(x: str) -> None: ...
def opengl_version_string() -> str: ... def opengl_version_string() -> str: ...
def systemd_move_pid_into_new_scope(pid: int, scope_name: str, description: str) -> 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): class MousePosition(TypedDict):
cell_x: int cell_x: int

View file

@ -963,7 +963,9 @@
opt('linux_bell_theme', '__custom', ctype='!bell_theme', opt('linux_bell_theme', '__custom', ctype='!bell_theme',
long_text=''' long_text='''
The XDG Sound Theme kitty will use to play the bell sound. 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: To change your sound theme desktop wide, create :file:`~/.local/share/sounds/__custom/index.theme` with the contents:
[Sound Theme] [Sound Theme]