Skip to content

Commit 1827713

Browse files
authored
Merge pull request #1429 from bynect/dunstify-category
Add --category to dunstify
2 parents 5408dfc + c3db473 commit 1827713

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

completions/dunstify.fishcomp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ complete -c dunstify -s A -l action -x -d 'Actions the user can invoke'
1616
complete -c dunstify -s t -l timeout -x -d 'The time in milliseconds until the notification expires'
1717
complete -c dunstify -s i -l icon -x -d 'An Icon that should be displayed with the notification'
1818
complete -c dunstify -s I -l raw_icon -r -d 'Path to the icon to be sent as raw image data'
19-
complete -c dunstify -s c -l capabilities -d 'Print the server capabilities and exit'
19+
complete -c dunstify -s c -l category -d 'The category of this notification'
20+
complete -c dunstify -l capabilities -d 'Print the server capabilities and exit'
2021
complete -c dunstify -s s -l serverinfo -d 'Print server information and exit'
2122
complete -c dunstify -s p -l printid -d 'Print id, which can be used to update/replace this notification'
2223
complete -c dunstify -s r -l replace -x -a '(__fish_dunstify_history)' -d 'Set id of this notification.'

docs/dunstify.pod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ Specifies an icon to display with the notification.
4747

4848
Path to the icon to be sent as raw image data.
4949

50-
=item B<-c, --capabilities>
50+
=item B<-c, --category=TYPE>
51+
52+
The category of this notification.
53+
54+
=item B<--capabilities>
5155

5256
Print the server capabilities and exit.
5357

dunstify.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ static gchar *summary = NULL;
1111
static gchar *body = NULL;
1212
static NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL;
1313
static gchar *urgency_str = NULL;
14+
static gchar *category = NULL;
1415
static gchar **hint_strs = NULL;
1516
static gchar **action_strs = NULL;
1617
static gint timeout = NOTIFY_EXPIRES_DEFAULT;
@@ -32,7 +33,8 @@ static GOptionEntry entries[] =
3233
{ "timeout", 't', 0, G_OPTION_ARG_INT, &timeout, "The time in milliseconds until the notification expires", "TIMEOUT" },
3334
{ "icon", 'i', 0, G_OPTION_ARG_STRING, &icon, "An icon that should be displayed with the notification", "ICON" },
3435
{ "raw_icon", 'I', 0, G_OPTION_ARG_STRING, &raw_icon_path, "Path to the icon to be sent as raw image data", "RAW_ICON"},
35-
{ "capabilities", 'c', 0, G_OPTION_ARG_NONE, &capabilities, "Print the server capabilities and exit", NULL},
36+
{ "category", 'c', 0, G_OPTION_ARG_STRING, &category, "The category of this notification", "TYPE" },
37+
{ "capabilities", 0, 0, G_OPTION_ARG_NONE, &capabilities, "Print the server capabilities and exit", NULL},
3638
{ "serverinfo", 's', 0, G_OPTION_ARG_NONE, &serverinfo, "Print server information and exit", NULL},
3739
{ "printid", 'p', 0, G_OPTION_ARG_NONE, &printid, "Print id, which can be used to update/replace this notification", NULL},
3840
{ "replace", 'r', 0, G_OPTION_ARG_INT, &replace_id, "Set id of this notification.", "ID"},
@@ -212,7 +214,7 @@ void put_id(NotifyNotification *n, guint32 id)
212214
{
213215
knickers *kn = n->priv;
214216

215-
/* And know I'm putting stuff into
217+
/* And now I'm putting stuff into
216218
* your knickers. I'm sorry.
217219
* I'm so sorry.
218220
* */
@@ -302,6 +304,9 @@ int main(int argc, char *argv[])
302304
notify_notification_set_timeout(n, timeout);
303305
notify_notification_set_urgency(n, urgency);
304306

307+
if (category != NULL)
308+
notify_notification_set_category(n, category);
309+
305310
GError *err = NULL;
306311

307312
if (raw_icon_path) {

0 commit comments

Comments
 (0)