mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
notify: split up the ${action} template parameter
Split it up into two, ${action-name} and ${action-label}.
Dunstify, for example, has a different syntax compared to notify-send:
notify-send: default=foobar
dunstify: default,foobar
This commit is contained in:
parent
d5c773a58b
commit
ecbec57a47
5 changed files with 14 additions and 18 deletions
|
|
@ -75,8 +75,8 @@
|
||||||
* `desktop-notifications.command` option, replaces `notify`.
|
* `desktop-notifications.command` option, replaces `notify`.
|
||||||
* `desktop-notifications.inhibit-when-focused` option, replaces
|
* `desktop-notifications.inhibit-when-focused` option, replaces
|
||||||
`notify-focus-inhibit`.
|
`notify-focus-inhibit`.
|
||||||
* `${icon}`, `${urgency}` and `${action}` added to the
|
* `${icon}`, `${urgency}`,`${action-name}` and `${action-label}` added
|
||||||
`desktop-notifications.command` template.
|
to the `desktop-notifications.command` template.
|
||||||
|
|
||||||
[1707]: https://codeberg.org/dnkl/foot/issues/1707
|
[1707]: https://codeberg.org/dnkl/foot/issues/1707
|
||||||
[1738]: https://codeberg.org/dnkl/foot/issues/1738
|
[1738]: https://codeberg.org/dnkl/foot/issues/1738
|
||||||
|
|
|
||||||
2
config.c
2
config.c
|
|
@ -3225,7 +3225,7 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
parse_modifiers(XKB_MOD_NAME_SHIFT, 5, &conf->mouse.selection_override_modifiers);
|
parse_modifiers(XKB_MOD_NAME_SHIFT, 5, &conf->mouse.selection_override_modifiers);
|
||||||
|
|
||||||
tokenize_cmdline(
|
tokenize_cmdline(
|
||||||
"notify-send --wait --app-name ${app-id} --icon ${icon} --urgency ${urgency} --action ${action} -- ${title} ${body}",
|
"notify-send --wait --app-name ${app-id} --icon ${icon} --urgency ${urgency} --action ${action-name},${action-label} --print-id -- ${title} ${body}",
|
||||||
&conf->desktop_notifications.command.argv.args);
|
&conf->desktop_notifications.command.argv.args);
|
||||||
tokenize_cmdline("xdg-open ${url}", &conf->url.launch.argv.args);
|
tokenize_cmdline("xdg-open ${url}", &conf->url.launch.argv.args);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -470,12 +470,9 @@ Note: do not set *TERM* here; use the *term* option in the main
|
||||||
|
|
||||||
There are two parts to handle this. First, the notification
|
There are two parts to handle this. First, the notification
|
||||||
must define an action. For this purpose, foot definse the
|
must define an action. For this purpose, foot definse the
|
||||||
template parameter *${action}*. It is intended to be used with
|
template parameters *${action-name}* and
|
||||||
e.g. notify-send's *-A,--action* option. The contents of
|
*${action-label}*. They are intended to be used with
|
||||||
*${action}* is not configurable, but will be on the form
|
e.g. notify-send's *-A,--action* option.
|
||||||
'name=label', where name is a notification internal reference
|
|
||||||
to the action, and label is what is displayed in the
|
|
||||||
notification.
|
|
||||||
|
|
||||||
Second, foot needs to know when the notification activated,
|
Second, foot needs to know when the notification activated,
|
||||||
and it needs to get hold of the XDG activation token.
|
and it needs to get hold of the XDG activation token.
|
||||||
|
|
@ -489,7 +486,7 @@ Note: do not set *TERM* here; use the *term* option in the main
|
||||||
line, prefixed with *xdgtoken=*.
|
line, prefixed with *xdgtoken=*.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
activate-foot
|
default
|
||||||
xdgtoken=18179adf579a7a904ce73754964b1ec3
|
xdgtoken=18179adf579a7a904ce73754964b1ec3
|
||||||
|
|
||||||
The expected format of stdout may change at any time. Please
|
The expected format of stdout may change at any time. Please
|
||||||
|
|
@ -499,7 +496,8 @@ Note: do not set *TERM* here; use the *term* option in the main
|
||||||
reporting the XDG activation token in any way. This means
|
reporting the XDG activation token in any way. This means
|
||||||
window activation will not work by default.
|
window activation will not work by default.
|
||||||
|
|
||||||
Default: _notify-send --wait --app-name ${app-id} --icon ${icon} --urgency ${urgency} --action ${action} -- ${title} ${body}_.
|
Default: _notify-send --wait --app-name ${app-id} --icon ${icon} --urgency ${urgency} --action ${action-name},${action-label} --print-id -- ${title} ${body}_.
|
||||||
|
|
||||||
|
|
||||||
*inhibit-when-focused*
|
*inhibit-when-focused*
|
||||||
Boolean. If enabled, foot will not display notifications if the
|
Boolean. If enabled, foot will not display notifications if the
|
||||||
|
|
|
||||||
2
foot.ini
2
foot.ini
|
|
@ -47,7 +47,7 @@
|
||||||
# command-focused=no
|
# command-focused=no
|
||||||
|
|
||||||
[desktop-notifications]
|
[desktop-notifications]
|
||||||
# command=notify-send --wait --app-name ${app-id} --icon ${icon} --urgency ${urgency} --action ${action} -- ${title} ${body}
|
# command=notify-send --wait --app-name ${app-id} --icon ${icon} --urgency ${urgency} --action ${action-name},${action-label} --print-id -- ${title} ${body}
|
||||||
# inhibit-when-focused=yes
|
# inhibit-when-focused=yes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
10
notify.c
10
notify.c
|
|
@ -78,7 +78,6 @@ fdm_notify_stdout(struct fdm *fdm, int fd, int events, void *data)
|
||||||
const struct terminal *term = data;
|
const struct terminal *term = data;
|
||||||
struct notification *notif = NULL;
|
struct notification *notif = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* Find notification */
|
/* Find notification */
|
||||||
tll_foreach(term->active_notifications, it) {
|
tll_foreach(term->active_notifications, it) {
|
||||||
if (it->item.stdout_fd == fd) {
|
if (it->item.stdout_fd == fd) {
|
||||||
|
|
@ -225,13 +224,13 @@ notify_notify(struct terminal *term, struct notification *notif)
|
||||||
? "normal" : "critical";
|
? "normal" : "critical";
|
||||||
|
|
||||||
if (!spawn_expand_template(
|
if (!spawn_expand_template(
|
||||||
&term->conf->desktop_notifications.command, 7,
|
&term->conf->desktop_notifications.command, 8,
|
||||||
(const char *[]){
|
(const char *[]){
|
||||||
"app-id", "window-title", "icon", "title", "body", "urgency", "action"},
|
"app-id", "window-title", "icon", "title", "body", "urgency", "action-name", "action-label"},
|
||||||
(const char *[]){
|
(const char *[]){
|
||||||
term->app_id ? term->app_id : term->conf->app_id,
|
term->app_id ? term->app_id : term->conf->app_id,
|
||||||
term->window_title, icon_name_or_path, title, body, urgency_str,
|
term->window_title, icon_name_or_path, title, body, urgency_str,
|
||||||
"default=Click to activate"},
|
"default", "Click to activate"},
|
||||||
&argc, &argv))
|
&argc, &argv))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -253,7 +252,7 @@ notify_notify(struct terminal *term, struct notification *notif)
|
||||||
notif->title = NULL;
|
notif->title = NULL;
|
||||||
notif->body = NULL;
|
notif->body = NULL;
|
||||||
notif->icon_id = NULL;
|
notif->icon_id = NULL;
|
||||||
notif->icon_symbolic_name= NULL;
|
notif->icon_symbolic_name = NULL;
|
||||||
notif->icon_data = NULL;
|
notif->icon_data = NULL;
|
||||||
notif->icon_data_sz = 0;
|
notif->icon_data_sz = 0;
|
||||||
notif = &tll_back(term->active_notifications);
|
notif = &tll_back(term->active_notifications);
|
||||||
|
|
@ -262,7 +261,6 @@ notify_notify(struct terminal *term, struct notification *notif)
|
||||||
|
|
||||||
|
|
||||||
if (stdout_fds[0] >= 0) {
|
if (stdout_fds[0] >= 0) {
|
||||||
xassert(notif->xdg_token == NULL);
|
|
||||||
fdm_add(term->fdm, stdout_fds[0], EPOLLIN,
|
fdm_add(term->fdm, stdout_fds[0], EPOLLIN,
|
||||||
&fdm_notify_stdout, (void *)term);
|
&fdm_notify_stdout, (void *)term);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue