mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
osc+notify: strcmp() -> streq()
This commit is contained in:
parent
f56da385fe
commit
a6bc9cafaf
2 changed files with 13 additions and 13 deletions
6
notify.c
6
notify.c
|
|
@ -220,7 +220,7 @@ notify_notify(struct terminal *term, struct notification *notif)
|
||||||
for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
|
for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
|
||||||
const struct notification_icon *icon = &term->notification_icons[i];
|
const struct notification_icon *icon = &term->notification_icons[i];
|
||||||
|
|
||||||
if (icon->id != NULL && strcmp(icon->id, notif->icon_id) == 0) {
|
if (icon->id != NULL && streq(icon->id, notif->icon_id)) {
|
||||||
icon_name_or_path = icon->symbolic_name != NULL
|
icon_name_or_path = icon->symbolic_name != NULL
|
||||||
? icon->symbolic_name
|
? icon->symbolic_name
|
||||||
: icon->tmp_file_name;
|
: icon->tmp_file_name;
|
||||||
|
|
@ -378,7 +378,7 @@ notify_icon_add(struct terminal *term, const char *id,
|
||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
|
for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
|
||||||
struct notification_icon *icon = &term->notification_icons[i];
|
struct notification_icon *icon = &term->notification_icons[i];
|
||||||
if (icon->id != NULL && strcmp(icon->id, id) == 0) {
|
if (icon->id != NULL && streq(icon->id, id)) {
|
||||||
BUG("notification icon cache already contains \"%s\"", id);
|
BUG("notification icon cache already contains \"%s\"", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -410,7 +410,7 @@ notify_icon_del(struct terminal *term, const char *id)
|
||||||
for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
|
for (size_t i = 0; i < ALEN(term->notification_icons); i++) {
|
||||||
struct notification_icon *icon = &term->notification_icons[i];
|
struct notification_icon *icon = &term->notification_icons[i];
|
||||||
|
|
||||||
if (icon->id == NULL || strcmp(icon->id, id) != 0)
|
if (icon->id == NULL || !streq(icon->id, id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LOG_DBG("expelled %s from the notification icon cache", icon->id);
|
LOG_DBG("expelled %s from the notification icon cache", icon->id);
|
||||||
|
|
|
||||||
20
osc.c
20
osc.c
|
|
@ -625,9 +625,9 @@ kitty_notification(struct terminal *term, char *string)
|
||||||
if (reverse)
|
if (reverse)
|
||||||
v++;
|
v++;
|
||||||
|
|
||||||
if (strcmp(v, "focus") == 0)
|
if (streq(v, "focus"))
|
||||||
focus = !reverse;
|
focus = !reverse;
|
||||||
else if (strcmp(v, "report") == 0)
|
else if (streq(v, "report"))
|
||||||
report = !reverse;
|
report = !reverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -658,13 +658,13 @@ kitty_notification(struct terminal *term, char *string)
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
/* payload content: title|body */
|
/* payload content: title|body */
|
||||||
if (strcmp(value, "title") == 0)
|
if (streq(value, "title"))
|
||||||
payload_type = PAYLOAD_TITLE;
|
payload_type = PAYLOAD_TITLE;
|
||||||
else if (strcmp(value, "body") == 0)
|
else if (streq(value, "body"))
|
||||||
payload_type = PAYLOAD_BODY;
|
payload_type = PAYLOAD_BODY;
|
||||||
else if (strcmp(value, "icon") == 0)
|
else if (streq(value, "icon"))
|
||||||
payload_type = PAYLOAD_ICON;
|
payload_type = PAYLOAD_ICON;
|
||||||
else if (strcmp(value, "?") == 0) {
|
else if (streq(value, "?")) {
|
||||||
/* Query capabilities */
|
/* Query capabilities */
|
||||||
|
|
||||||
char when_str[64];
|
char when_str[64];
|
||||||
|
|
@ -688,11 +688,11 @@ kitty_notification(struct terminal *term, char *string)
|
||||||
case 'o':
|
case 'o':
|
||||||
/* honor when: always|unfocused|invisible */
|
/* honor when: always|unfocused|invisible */
|
||||||
have_o = true;
|
have_o = true;
|
||||||
if (strcmp(value, "always") == 0)
|
if (streq(value, "always"))
|
||||||
when = NOTIFY_ALWAYS;
|
when = NOTIFY_ALWAYS;
|
||||||
else if (strcmp(value, "unfocused") == 0)
|
else if (streq(value, "unfocused"))
|
||||||
when = NOTIFY_UNFOCUSED;
|
when = NOTIFY_UNFOCUSED;
|
||||||
else if (strcmp(value, "invisible") == 0)
|
else if (streq(value, "invisible"))
|
||||||
when = NOTIFY_INVISIBLE;
|
when = NOTIFY_INVISIBLE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -733,7 +733,7 @@ kitty_notification(struct terminal *term, char *string)
|
||||||
/* Search for an existing (d=0) notification to update */
|
/* Search for an existing (d=0) notification to update */
|
||||||
struct notification *notif = NULL;
|
struct notification *notif = NULL;
|
||||||
tll_foreach(term->kitty_notifications, it) {
|
tll_foreach(term->kitty_notifications, it) {
|
||||||
if (strcmp(it->item.id, id) == 0) {
|
if (streq(it->item.id, id)) {
|
||||||
/* Found existing notification */
|
/* Found existing notification */
|
||||||
notif = &it->item;
|
notif = &it->item;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue