aboutsummaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-04-01 17:59:47 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-04-01 17:59:47 +0000
commitec7a7684876c06764a583a1cefe2a93f6706e3ca (patch)
treea56aacfe68b35eadbf4025a5c366b36585fe7d82 /client.c
parentcompletions: zsh: repair -a,--app-id completions (diff)
conf: add 'title' conf option and --title command line option
Diffstat (limited to 'client.c')
-rw-r--r--client.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/client.c b/client.c
index a7ba7e30..754f349b 100644
--- a/client.c
+++ b/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)
{