diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-03-27 20:14:49 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-03-27 20:14:49 +0000 |
| commit | 758fd9fd58b25ab285868db7f36afdf9378df733 (patch) | |
| tree | 6cf37e07209b972f42485a99d968f31721282d79 /client.c | |
| parent | foot: add --maximized and --fullscreen command line options (diff) | |
client: add --maximized and --fullscreen
We now create a copy of the config for each client, and updates it
with the values passed from the client.
Since we're not actually cloning it (and e.g. strdup() all strings
etc) we can't call conf_destroy() to free it, but need to free just
the strings we've replaced.
Diffstat (limited to 'client.c')
| -rw-r--r-- | client.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -33,6 +33,8 @@ 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" + " --maximized start in maximized mode\n" + " --fullscreen start in fullscreen mode\n" " --login-shell start shell as a login shell\n" " -s,--server-socket=PATH path to the server UNIX domain socket (default=$XDG_RUNTIME_DIR/foot-$XDG_SESSION_ID.sock)\n" " -l,--log-colorize=[never|always|auto] enable/disable colorization of log output on stderr\n" @@ -48,6 +50,8 @@ main(int argc, char *const *argv) static const struct option longopts[] = { {"term", required_argument, 0, 't'}, + {"maximized", no_argument, 0, 'm'}, + {"fullscreen", no_argument, 0, 'F'}, {"login-shell", no_argument, 0, 'L'}, {"server-socket", required_argument, 0, 's'}, {"log-colorize", optional_argument, NULL, 'l'}, @@ -60,6 +64,8 @@ main(int argc, char *const *argv) const char *server_socket_path = NULL; enum log_colorize log_colorize = LOG_COLORIZE_AUTO; bool login_shell = false; + bool maximized = false; + bool fullscreen = false; while (true) { int c = getopt_long(argc, argv, ":t:s:l::hv", longopts, NULL); @@ -75,6 +81,16 @@ main(int argc, char *const *argv) login_shell = true; break; + case ',': + maximized = true; + fullscreen = false; + break; + + case 'F': + fullscreen = true; + maximized = false; + break; + case 's': server_socket_path = optarg; break; @@ -177,6 +193,8 @@ main(int argc, char *const *argv) /* Calculate total length */ total_len += sizeof(cwd_len) + cwd_len; total_len += sizeof(term_len) + term_len; + total_len += sizeof(uint8_t); /* maximized */ + total_len += sizeof(uint8_t); /* fullscreen */ total_len += sizeof(uint8_t); /* login_shell */ total_len += sizeof(argc); @@ -207,6 +225,16 @@ main(int argc, char *const *argv) goto err; } + if (send(fd, &(uint8_t){maximized}, sizeof(uint8_t), 0) != sizeof(uint8_t)) { + LOG_ERRNO("failed to send maximized"); + goto err; + } + + if (send(fd, &(uint8_t){fullscreen}, sizeof(uint8_t), 0) != sizeof(uint8_t)) { + LOG_ERRNO("failed to send fullscreen"); + goto err; + } + if (send(fd, &(uint8_t){login_shell}, sizeof(uint8_t), 0) != sizeof(uint8_t)) { LOG_ERRNO("failed to send login-shell"); goto err; |
