mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
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).
This commit is contained in:
parent
c6208a98c8
commit
7984f08925
4 changed files with 8 additions and 46 deletions
11
csi.c
11
csi.c
|
|
@ -1377,10 +1377,6 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
||||||
tll_push_back(
|
tll_push_back(
|
||||||
term->window_title_stack, xstrdup(term->window_title));
|
term->window_title_stack, xstrdup(term->window_title));
|
||||||
}
|
}
|
||||||
if (what == 0 || what == 1) {
|
|
||||||
tll_push_back(
|
|
||||||
term->window_icon_stack, xstrdup(term->window_icon));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1394,13 +1390,6 @@ csi_dispatch(struct terminal *term, uint8_t final)
|
||||||
free(title);
|
free(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (what == 0 || what == 1) {
|
|
||||||
if (tll_length(term->window_icon_stack) > 0) {
|
|
||||||
char *icon = tll_pop_back(term->window_icon_stack);
|
|
||||||
term_set_icon(term, icon);
|
|
||||||
free(icon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
osc.c
2
osc.c
|
|
@ -1147,11 +1147,9 @@ osc_dispatch(struct terminal *term)
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 0: /* icon + title */
|
case 0: /* icon + title */
|
||||||
term_set_window_title(term, string);
|
term_set_window_title(term, string);
|
||||||
term_set_icon(term, string);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: /* icon */
|
case 1: /* icon */
|
||||||
term_set_icon(term, string);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* title */
|
case 2: /* title */
|
||||||
|
|
|
||||||
36
terminal.c
36
terminal.c
|
|
@ -1814,9 +1814,7 @@ term_destroy(struct terminal *term)
|
||||||
composed_free(term->composed);
|
composed_free(term->composed);
|
||||||
|
|
||||||
free(term->app_id);
|
free(term->app_id);
|
||||||
free(term->window_icon);
|
|
||||||
free(term->window_title);
|
free(term->window_title);
|
||||||
tll_free_and_free(term->window_icon_stack, free);
|
|
||||||
tll_free_and_free(term->window_title_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++)
|
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;
|
term->saved_charsets = term->charsets;
|
||||||
tll_free_and_free(term->window_title_stack, free);
|
tll_free_and_free(term->window_title_stack, free);
|
||||||
term_set_window_title(term, term->conf->title);
|
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_app_id(term, NULL);
|
||||||
term_set_icon(term, NULL);
|
|
||||||
|
|
||||||
term_set_user_mouse_cursor(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);
|
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 *
|
const char *
|
||||||
term_icon(const struct terminal *term)
|
term_icon(const struct terminal *term)
|
||||||
{
|
{
|
||||||
const char *app_id =
|
const char *app_id =
|
||||||
term->app_id != NULL ? term->app_id : term->conf->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
|
? term->window_icon
|
||||||
: streq(app_id, "footclient")
|
:
|
||||||
|
#endif
|
||||||
|
streq(app_id, "footclient")
|
||||||
? "foot"
|
? "foot"
|
||||||
: app_id;
|
: app_id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -552,8 +552,8 @@ struct terminal {
|
||||||
bool window_title_has_been_set;
|
bool window_title_has_been_set;
|
||||||
char *window_title;
|
char *window_title;
|
||||||
tll(char *) window_title_stack;
|
tll(char *) window_title_stack;
|
||||||
char *window_icon;
|
//char *window_icon; /* No escape sequence available to set the icon */
|
||||||
tll(char *)window_icon_stack;
|
//tll(char *)window_icon_stack;
|
||||||
char *app_id;
|
char *app_id;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -932,7 +932,6 @@ void term_set_user_mouse_cursor(struct terminal *term, const char *cursor);
|
||||||
|
|
||||||
void term_set_window_title(struct terminal *term, const char *title);
|
void term_set_window_title(struct terminal *term, const char *title);
|
||||||
void term_set_app_id(struct terminal *term, const char *app_id);
|
void term_set_app_id(struct terminal *term, const char *app_id);
|
||||||
void term_set_icon(struct terminal *term, const char *icon);
|
|
||||||
const char *term_icon(const struct terminal *term);
|
const char *term_icon(const struct terminal *term);
|
||||||
void term_flash(struct terminal *term, unsigned duration_ms);
|
void term_flash(struct terminal *term, unsigned duration_ms);
|
||||||
void term_bell(struct terminal *term);
|
void term_bell(struct terminal *term);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue