mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 16:37:27 +00:00
Pass the first notification type as category to the dbus server
This commit is contained in:
parent
62bd6c88e9
commit
89aa82e8d7
6 changed files with 9 additions and 7 deletions
2
glfw/glfw3.h
vendored
2
glfw/glfw3.h
vendored
|
|
@ -1316,7 +1316,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;
|
||||
|
||||
|
|
|
|||
1
glfw/linux_notify.c
vendored
1
glfw/linux_notify.c
vendored
|
|
@ -177,6 +177,7 @@ glfw_dbus_send_user_notification(const GLFWDBUSNotificationData *n, GLFWDBusnoti
|
|||
check_call(dbus_message_iter_close_container, &array, &dict); \
|
||||
}
|
||||
append_sv_dictionary_entry("urgency", DBUS_TYPE_BYTE, n->urgency);
|
||||
if (n->category && n->category[0]) append_sv_dictionary_entry("category", DBUS_TYPE_STRING, n->category);
|
||||
|
||||
check_call(dbus_message_iter_close_container, &args, &array);
|
||||
APPEND(args, DBUS_TYPE_INT32, n->timeout)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue