aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-09-13 06:51:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-09-13 07:04:18 +0000
commit7984f08925e18e24e6b54ac4498d65fa26b2a4d6 (patch)
tree377f4a8443f768c18068b5b8f8d9e962b10b126c /terminal.c
parentmain: include toplevel-icon support in --version output (diff)
osc: OSC-1 does not set the icon, it sets the icon _label_
In fact, there appears there *is* no escape sequence to set the icon. Keep most of the logic in place, but in practice, we'll always set the icon to the app-id. That is, at startup, we set it to the configured app-id (either from config, or the command line). OSC-176, which sets the app-id, also updates the icon (to the app-id).
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/terminal.c b/terminal.c
index 5e9a60a5..6d62a3ed 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1814,9 +1814,7 @@ term_destroy(struct terminal *term)
composed_free(term->composed);
free(term->app_id);
- free(term->window_icon);
free(term->window_title);
- tll_free_and_free(term->window_icon_stack, free);
tll_free_and_free(term->window_title_stack, free);
for (size_t i = 0; i < sizeof(term->fonts) / sizeof(term->fonts[0]); i++)
@@ -2048,9 +2046,7 @@ term_reset(struct terminal *term, bool hard)
term->saved_charsets = term->charsets;
tll_free_and_free(term->window_title_stack, free);
term_set_window_title(term, term->conf->title);
- tll_free_and_free(term->window_icon_stack, free);
term_set_app_id(term, NULL);
- term_set_icon(term, NULL);
term_set_user_mouse_cursor(term, NULL);
@@ -3610,39 +3606,19 @@ term_set_app_id(struct terminal *term, const char *app_id)
render_refresh_icon(term);
}
-void
-term_set_icon(struct terminal *term, const char *icon)
-{
- if (icon != NULL && *icon == '\0')
- icon = NULL;
- if (term->window_icon == NULL && icon == NULL)
- return;
- if (term->window_icon != NULL && icon != NULL && streq(term->window_icon, icon))
- return;
-
- if (icon != NULL && !is_valid_utf8(icon)) {
- LOG_WARN("%s: icon label is not valid UTF-8, ignoring", icon);
- return;
- }
-
- free(term->window_icon);
- if (icon != NULL) {
- term->window_icon = xstrdup(icon);
- } else {
- term->window_icon = NULL;
- }
- render_refresh_icon(term);
-}
-
const char *
term_icon(const struct terminal *term)
{
const char *app_id =
term->app_id != NULL ? term->app_id : term->conf->app_id;
- return term->window_icon != NULL
+ return
+#if 0
+term->window_icon != NULL
? term->window_icon
- : streq(app_id, "footclient")
+ :
+ #endif
+ streq(app_id, "footclient")
? "foot"
: app_id;
}