add session save and session load functionality
New [key-bindings]:
- session-save: captures cwd and foreground process argv to ~/.local/share/foot/state/{name}.json
- session-save-secure: prompts for a password, encrypts the scrollback with argon2id + XChaCha20-Poly1305 (libsodium) and writes it to {name}.scrollback.enc(stores up to 1Mb scrollback buffer).
- session-load: a minimal fuzzy picker that displays saved sessions (both secure and vanilla), UI piggybacks on search bar subsurface. use arrows to navigate and delete to delete a previously saved session.
This commit is contained in:
parent
05ee680778
commit
cabddb26e6
16 changed files with 1947 additions and 49 deletions
24
terminal.c
24
terminal.c
|
|
@ -1511,6 +1511,17 @@ struct terminal *term_tab_new(struct terminal *primary, int argc,
|
|||
char *const *argv, const char *const *envp,
|
||||
void (*shutdown_cb)(void *data, int exit_code),
|
||||
void *shutdown_data) {
|
||||
return term_tab_new_with_cwd(primary, NULL, argc, argv, envp, shutdown_cb,
|
||||
shutdown_data);
|
||||
}
|
||||
|
||||
struct terminal *term_tab_new_with_cwd(struct terminal *primary,
|
||||
const char *override_cwd, int argc,
|
||||
char *const *argv,
|
||||
const char *const *envp,
|
||||
void (*shutdown_cb)(void *data,
|
||||
int exit_code),
|
||||
void *shutdown_data) {
|
||||
struct wl_window *win = primary->window;
|
||||
|
||||
if (win->tab_count >= TAB_MAX) {
|
||||
|
|
@ -1725,9 +1736,12 @@ struct terminal *term_tab_new(struct terminal *primary, int argc,
|
|||
.cb_data = shutdown_data,
|
||||
},
|
||||
.foot_exe = xstrdup(primary->foot_exe),
|
||||
.cwd = xstrdup(conf->tabs.inherit_cwd
|
||||
? win->term->cwd
|
||||
: (getenv("HOME") != NULL ? getenv("HOME") : "/")),
|
||||
.cwd = xstrdup(override_cwd != NULL
|
||||
? override_cwd
|
||||
: (conf->tabs.inherit_cwd
|
||||
? win->term->cwd
|
||||
: (getenv("HOME") != NULL ? getenv("HOME")
|
||||
: "/"))),
|
||||
.grapheme_shaping = conf->tweak.grapheme_shaping,
|
||||
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
||||
.ime_enabled = true,
|
||||
|
|
@ -1764,6 +1778,10 @@ struct terminal *term_tab_new(struct terminal *primary, int argc,
|
|||
|
||||
add_utmp_record(conf, reaper, ptmx);
|
||||
|
||||
/* Initialize window title to the configured default; otherwise a freshly
|
||||
* spawned child sending CSI 22 t (push title) sees a NULL title. */
|
||||
term_set_window_title(term, conf->title);
|
||||
|
||||
if ((term->slave = slave_spawn(
|
||||
term->ptmx, argc, term->cwd, argv, envp, &conf->env_vars, conf->term,
|
||||
conf->shell, conf->login_shell, &conf->notifications)) == -1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue