Skip to content

Commit

Permalink
Add keyboard shorcuts again, now in the global section
Browse files Browse the repository at this point in the history
  • Loading branch information
fwsmit committed Feb 22, 2022
1 parent b56e7da commit 1782222
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 13 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,6 @@ you do want it removed as well.

## Troubleshooting

### Shortcuts stopped working

Shortcut support and `[shortcuts]` section in config have been removed for
simplicity. Use your window manager/desktop environment and `dunstctl` to
replace it.

### Cannot set settings via command line

This functionality was removed during the refactor. It might be re-added later
Expand Down
37 changes: 31 additions & 6 deletions docs/dunst.5.pod
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,37 @@ the notification sent before the user defined timeout.

=back

=head2 Keyboard shortcuts (X11 only)

Keyboard shortcuts are defined in the following format: "Modifier+key" where the
modifier is one of ctrl,mod1,mod2,mod3,mod4 and key is any keyboard key.

Note that the keyboard shortcuts have been moved to the B<global> section of the
config for consistency with other settings.

Alternatively you can also define shortcuts inside your window manager and bind
them to dunstctl(1) commands.

=over 4

=item B<close>

Specifies the keyboard shortcut for closing a notification.

=item B<close_all>

Specifies the keyboard shortcut for closing all currently displayed notifications.

=item B<history>

Specifies the keyboard shortcut for recalling a single notification from history.

=item B<context>

Specifies the keyboard shortcut that opens the context menu.

=back

=head2 Urgency sections

The urgency sections work in a similar way to rules and can be used to specify
Expand Down Expand Up @@ -1111,12 +1142,6 @@ Time units understood by dunst are "ms", "s", "m", "h" and "d".

Example time: "1000ms" "10m"

=head1 MISCELLANEOUS

Dunst used to provide shortcuts to act on notifications via key-bindings, but it
has now been moved to its own utility. For more information, see the manual for
dunstctl(1).

=head1 AUTHORS

Written by Sascha Kruse <knopwob@googlemail.com>
Expand Down
41 changes: 41 additions & 0 deletions src/settings_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,47 @@ static const struct setting allowed_settings[] = {
.parser_data = NULL,
},

// Keyboard shortcuts (still in global section)
{
.name = "close",
.section = "global",
.description = "Shortcut for closing one notification",
.type = TYPE_STRING,
.default_value = "none",
.value = &settings.close_ks.str,
.parser = NULL,
.parser_data = NULL,
},
{
.name = "close_all",
.section = "global",
.description = "Shortcut for closing all notifications",
.type = TYPE_STRING,
.default_value = "none",
.value = &settings.close_all_ks.str,
.parser = NULL,
.parser_data = NULL,
},
{
.name = "history",
.section = "global",
.description = "Shortcut to pop the last notification from history",
.type = TYPE_STRING,
.default_value = "none",
.value = &settings.history_ks.str,
.parser = NULL,
.parser_data = NULL,
},
{
.name = "context",
.section = "global",
.description = "Shortcut for context menu",
.type = TYPE_STRING,
.default_value = "none",
.value = &settings.context_ks.str,
.parser = NULL,
.parser_data = NULL,
},
};
#endif
/* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */
2 changes: 1 addition & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static const char* deprecated_sections[] = {

static const char* deprecated_sections_message[] = {
"The settings from the frame section have been moved to the global section.", // frame
"Acting on notifications has been moved to its own utility. For more information, see the manual for dunstctl.", // shortcuts
"Settings in the shortcuts sections have been moved to the global section.\nAlternatively you can bind shortcuts in you window manager to dunstctl commands. For that, see the manual for dunstctl.", // shortcuts
};

/* see utils.h */
Expand Down

0 comments on commit 1782222

Please sign in to comment.