mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-12 19:49:32 +02:00
Pass the first notification type as category to the dbus server
This commit is contained in:
@@ -555,6 +555,7 @@ def dbus_send_notification(
|
||||
timeout: int = -1,
|
||||
urgency: int = 1,
|
||||
replaces: int = 0,
|
||||
category: str = '',
|
||||
) -> int:
|
||||
pass
|
||||
|
||||
@@ -569,7 +570,7 @@ def cocoa_send_notification(
|
||||
body: str,
|
||||
category: MacOSNotificationCategory,
|
||||
categories: tuple[MacOSNotificationCategory, ...],
|
||||
image_path: str = "",
|
||||
image_path: str = '',
|
||||
urgency: int = 1,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
2
kitty/glfw-wrapper.h
generated
2
kitty/glfw-wrapper.h
generated
@@ -1054,7 +1054,7 @@ typedef struct GLFWLayerShellConfig {
|
||||
} GLFWLayerShellConfig;
|
||||
|
||||
typedef struct GLFWDBUSNotificationData {
|
||||
const char *app_name, *icon, *summary, *body, **actions; size_t num_actions;
|
||||
const char *app_name, *icon, *summary, *body, *category, **actions; size_t num_actions;
|
||||
int32_t timeout; uint8_t urgency; uint32_t replaces;
|
||||
} GLFWDBUSNotificationData;
|
||||
|
||||
|
||||
@@ -2086,10 +2086,10 @@ static PyObject*
|
||||
dbus_send_notification(PyObject *self UNUSED, PyObject *args, PyObject *kw) {
|
||||
int timeout = -1, urgency = 1; unsigned int replaces = 0;
|
||||
GLFWDBUSNotificationData d = {0};
|
||||
static const char* kwlist[] = {"app_name", "app_icon", "title", "body", "actions", "timeout", "urgency", "replaces", NULL};
|
||||
static const char* kwlist[] = {"app_name", "app_icon", "title", "body", "actions", "timeout", "urgency", "replaces", "category", NULL};
|
||||
PyObject *actions = NULL;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "ssssO!|iiI", (char**)kwlist,
|
||||
&d.app_name, &d.icon, &d.summary, &d.body, &PyDict_Type, &actions, &timeout, &urgency, &replaces)) return NULL;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "ssssO!|iiIs", (char**)kwlist,
|
||||
&d.app_name, &d.icon, &d.summary, &d.body, &PyDict_Type, &actions, &timeout, &urgency, &replaces, &d.category)) return NULL;
|
||||
if (!glfwDBusUserNotify) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Failed to load glfwDBusUserNotify, did you call glfw_init?");
|
||||
return NULL;
|
||||
|
||||
@@ -727,7 +727,7 @@ class FreeDesktopIntegration(DesktopIntegration):
|
||||
actions[str(i+1)] = b
|
||||
desktop_notification_id = dbus_send_notification(
|
||||
app_name=nc.application_name or 'kitty', app_icon=app_icon, title=nc.title, body=body, actions=actions,
|
||||
timeout=nc.timeout, urgency=nc.urgency.value, replaces=replaces_dbus_id)
|
||||
timeout=nc.timeout, urgency=nc.urgency.value, replaces=replaces_dbus_id, category=(nc.notification_types or ('',))[0])
|
||||
if debug_desktop_integration:
|
||||
log_error(f'Requested creation of notification with {desktop_notification_id=}')
|
||||
if existing_desktop_notification_id and replaces_dbus_id:
|
||||
|
||||
Reference in New Issue
Block a user