Skip to content

Commit

Permalink
Merge pull request #1429 from bynect/dunstify-category
Browse files Browse the repository at this point in the history
Add --category to dunstify
  • Loading branch information
bynect authored Jan 11, 2025
2 parents 5408dfc + c3db473 commit 1827713
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion completions/dunstify.fishcomp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ complete -c dunstify -s A -l action -x -d 'Actions the user can invoke'
complete -c dunstify -s t -l timeout -x -d 'The time in milliseconds until the notification expires'
complete -c dunstify -s i -l icon -x -d 'An Icon that should be displayed with the notification'
complete -c dunstify -s I -l raw_icon -r -d 'Path to the icon to be sent as raw image data'
complete -c dunstify -s c -l capabilities -d 'Print the server capabilities and exit'
complete -c dunstify -s c -l category -d 'The category of this notification'
complete -c dunstify -l capabilities -d 'Print the server capabilities and exit'
complete -c dunstify -s s -l serverinfo -d 'Print server information and exit'
complete -c dunstify -s p -l printid -d 'Print id, which can be used to update/replace this notification'
complete -c dunstify -s r -l replace -x -a '(__fish_dunstify_history)' -d 'Set id of this notification.'
Expand Down
6 changes: 5 additions & 1 deletion docs/dunstify.pod
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ Specifies an icon to display with the notification.

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

=item B<-c, --capabilities>
=item B<-c, --category=TYPE>

The category of this notification.

=item B<--capabilities>

Print the server capabilities and exit.

Expand Down
9 changes: 7 additions & 2 deletions dunstify.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ static gchar *summary = NULL;
static gchar *body = NULL;
static NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL;
static gchar *urgency_str = NULL;
static gchar *category = NULL;
static gchar **hint_strs = NULL;
static gchar **action_strs = NULL;
static gint timeout = NOTIFY_EXPIRES_DEFAULT;
Expand All @@ -32,7 +33,8 @@ static GOptionEntry entries[] =
{ "timeout", 't', 0, G_OPTION_ARG_INT, &timeout, "The time in milliseconds until the notification expires", "TIMEOUT" },
{ "icon", 'i', 0, G_OPTION_ARG_STRING, &icon, "An icon that should be displayed with the notification", "ICON" },
{ "raw_icon", 'I', 0, G_OPTION_ARG_STRING, &raw_icon_path, "Path to the icon to be sent as raw image data", "RAW_ICON"},
{ "capabilities", 'c', 0, G_OPTION_ARG_NONE, &capabilities, "Print the server capabilities and exit", NULL},
{ "category", 'c', 0, G_OPTION_ARG_STRING, &category, "The category of this notification", "TYPE" },
{ "capabilities", 0, 0, G_OPTION_ARG_NONE, &capabilities, "Print the server capabilities and exit", NULL},
{ "serverinfo", 's', 0, G_OPTION_ARG_NONE, &serverinfo, "Print server information and exit", NULL},
{ "printid", 'p', 0, G_OPTION_ARG_NONE, &printid, "Print id, which can be used to update/replace this notification", NULL},
{ "replace", 'r', 0, G_OPTION_ARG_INT, &replace_id, "Set id of this notification.", "ID"},
Expand Down Expand Up @@ -212,7 +214,7 @@ void put_id(NotifyNotification *n, guint32 id)
{
knickers *kn = n->priv;

/* And know I'm putting stuff into
/* And now I'm putting stuff into
* your knickers. I'm sorry.
* I'm so sorry.
* */
Expand Down Expand Up @@ -302,6 +304,9 @@ int main(int argc, char *argv[])
notify_notification_set_timeout(n, timeout);
notify_notification_set_urgency(n, urgency);

if (category != NULL)
notify_notification_set_category(n, category);

GError *err = NULL;

if (raw_icon_path) {
Expand Down

0 comments on commit 1827713

Please sign in to comment.