mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-21 06:46:34 -04:00
term: track current window title in terminal struct
This commit is contained in:
parent
326808f94d
commit
97350f6488
4 changed files with 17 additions and 4 deletions
3
main.c
3
main.c
|
|
@ -589,7 +589,7 @@ main(int argc, char *const *argv)
|
||||||
xdg_toplevel_add_listener(term.wl.xdg_toplevel, &xdg_toplevel_listener, &term);
|
xdg_toplevel_add_listener(term.wl.xdg_toplevel, &xdg_toplevel_listener, &term);
|
||||||
|
|
||||||
xdg_toplevel_set_app_id(term.wl.xdg_toplevel, "foot");
|
xdg_toplevel_set_app_id(term.wl.xdg_toplevel, "foot");
|
||||||
render_set_title(&term, "foot");
|
term_set_window_title(&term, "foot");
|
||||||
|
|
||||||
wl_surface_commit(term.wl.surface);
|
wl_surface_commit(term.wl.surface);
|
||||||
wl_display_roundtrip(term.wl.display);
|
wl_display_roundtrip(term.wl.display);
|
||||||
|
|
@ -848,6 +848,7 @@ out:
|
||||||
for (int row = 0; row < term.alt.num_rows; row++)
|
for (int row = 0; row < term.alt.num_rows; row++)
|
||||||
grid_row_free(term.alt.rows[row]);
|
grid_row_free(term.alt.rows[row]);
|
||||||
free(term.alt.rows);
|
free(term.alt.rows);
|
||||||
|
free(term.window_title);
|
||||||
|
|
||||||
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++) {
|
||||||
struct font *f = &term.fonts[i];
|
struct font *f = &term.fonts[i];
|
||||||
|
|
|
||||||
6
osc.c
6
osc.c
|
|
@ -234,9 +234,9 @@ osc_dispatch(struct terminal *term)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 0: render_set_title(term, string); break; /* icon + title */
|
case 0: term_set_window_title(term, string); break; /* icon + title */
|
||||||
case 1: break; /* icon */
|
case 1: break; /* icon */
|
||||||
case 2: render_set_title(term, string); break; /* title */
|
case 2: term_set_window_title(term, string); break; /* title */
|
||||||
case 52: osc_selection(term, string); break;
|
case 52: osc_selection(term, string); break;
|
||||||
|
|
||||||
case 104: /* Reset Color Number 'c' */
|
case 104: /* Reset Color Number 'c' */
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "grid.h"
|
#include "grid.h"
|
||||||
|
#include "render.h"
|
||||||
#include "vt.h"
|
#include "vt.h"
|
||||||
|
|
||||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||||
|
|
@ -460,3 +461,11 @@ term_mouse_motion(struct terminal *term, int button, int row, int col,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
term_set_window_title(struct terminal *term, const char *title)
|
||||||
|
{
|
||||||
|
free(term->window_title);
|
||||||
|
term->window_title = strdup(title);
|
||||||
|
render_set_title(term, term->window_title);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,7 @@ struct terminal {
|
||||||
|
|
||||||
int selected_charset;
|
int selected_charset;
|
||||||
enum charset charset[4]; /* G0-G3 */
|
enum charset charset[4]; /* G0-G3 */
|
||||||
|
char *window_title;
|
||||||
|
|
||||||
struct vt vt;
|
struct vt vt;
|
||||||
struct kbd kbd;
|
struct kbd kbd;
|
||||||
|
|
@ -341,3 +342,5 @@ void term_mouse_up(struct terminal *term, int button, int row, int col,
|
||||||
bool shift, bool alt, bool ctrl);
|
bool shift, bool alt, bool ctrl);
|
||||||
void term_mouse_motion(struct terminal *term, int button, int row, int col,
|
void term_mouse_motion(struct terminal *term, int button, int row, int col,
|
||||||
bool shift, bool alt, bool ctrl);
|
bool shift, bool alt, bool ctrl);
|
||||||
|
|
||||||
|
void term_set_window_title(struct terminal *term, const char *title);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue