mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
conf: add 'title' conf option and --title command line option
This commit is contained in:
parent
57761fbd50
commit
ec7a768487
12 changed files with 65 additions and 2 deletions
16
client.c
16
client.c
|
|
@ -33,6 +33,7 @@ print_usage(const char *prog_name)
|
|||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" -t,--term=TERM value to set the environment variable TERM to (foot)\n"
|
||||
" --title=TITLE initial window title (foot)\n"
|
||||
" -a,--app-id=ID window application ID (foot)\n"
|
||||
" --maximized start in maximized mode\n"
|
||||
" --fullscreen start in fullscreen mode\n"
|
||||
|
|
@ -51,6 +52,7 @@ main(int argc, char *const *argv)
|
|||
|
||||
static const struct option longopts[] = {
|
||||
{"term", required_argument, NULL, 't'},
|
||||
{"title", required_argument, NULL, 'T'},
|
||||
{"app-id", required_argument, NULL, 'a'},
|
||||
{"maximized", no_argument, NULL, 'm'},
|
||||
{"fullscreen", no_argument, NULL, 'F'},
|
||||
|
|
@ -63,6 +65,7 @@ main(int argc, char *const *argv)
|
|||
};
|
||||
|
||||
const char *term = "";
|
||||
const char *title = "";
|
||||
const char *app_id = "";
|
||||
const char *server_socket_path = NULL;
|
||||
enum log_colorize log_colorize = LOG_COLORIZE_AUTO;
|
||||
|
|
@ -80,6 +83,10 @@ main(int argc, char *const *argv)
|
|||
term = optarg;
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
title = optarg;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
app_id = optarg;
|
||||
break;
|
||||
|
|
@ -194,12 +201,14 @@ main(int argc, char *const *argv)
|
|||
}
|
||||
const uint16_t cwd_len = strlen(cwd) + 1;
|
||||
const uint16_t term_len = strlen(term) + 1;
|
||||
const uint16_t title_len = strlen(title) + 1;
|
||||
const uint16_t app_id_len = strlen(app_id) + 1;
|
||||
uint32_t total_len = 0;
|
||||
|
||||
/* Calculate total length */
|
||||
total_len += sizeof(cwd_len) + cwd_len;
|
||||
total_len += sizeof(term_len) + term_len;
|
||||
total_len += sizeof(title_len) + title_len;
|
||||
total_len += sizeof(app_id_len) + app_id_len;
|
||||
total_len += sizeof(uint8_t); /* maximized */
|
||||
total_len += sizeof(uint8_t); /* fullscreen */
|
||||
|
|
@ -233,6 +242,13 @@ main(int argc, char *const *argv)
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (send(fd, &title_len, sizeof(title_len), 0) != sizeof(title_len) ||
|
||||
send(fd, title, title_len, 0) != title_len)
|
||||
{
|
||||
LOG_ERRNO("failed to send title to server");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (send(fd, &app_id_len, sizeof(app_id_len), 0) != sizeof(app_id_len) ||
|
||||
send(fd, app_id, app_id_len, 0) != app_id_len)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue