aboutsummaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-03-27 20:16:42 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-03-27 20:16:42 +0000
commit598ac4bcd0690995fbf94c7a2b17564dbf69a5f1 (patch)
tree0d98b2eab053838eca647a1bd4b680dc20f90156 /client.c
parentconf: max-shm-pool-size-mb=0 now disables SHM scrolling (diff)
parentclient: add --maximized and --fullscreen (diff)
Merge branch 'master' into scroll-damage-performance
Diffstat (limited to 'client.c')
-rw-r--r--client.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/client.c b/client.c
index faa7c919..7d188609 100644
--- a/client.c
+++ b/client.c
@@ -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;