From 728e23863c301bce84b3000987e34f3de2c41f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 26 Mar 2020 19:47:00 +0100 Subject: [PATCH] foot: add --maximized and --fullscreen command line options --- completions/zsh/_foot | 2 ++ doc/foot.1.scd | 8 ++++++++ main.c | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/completions/zsh/_foot b/completions/zsh/_foot index 7cef2646..95e8d98e 100644 --- a/completions/zsh/_foot +++ b/completions/zsh/_foot @@ -5,6 +5,8 @@ _arguments \ '(-c --config)'{-c,--config}'[path to configuration file (XDG_CONFIG_HOME/footrc)]:config:_files' \ '(-f --font)'{-f,--font}'[font name and style in fontconfig format (monospace)]:font:->fonts' \ '(-t --term)'{-t,--term}'[value to set the environment variable TERM to (foot)]:term:->terms' \ + '--maximized[start in maximized mode]' \ + '--fullscreen[start in fullscreen mode]' \ '--login-shell[start shell as a login shell]' \ '(-g --geometry)'{-g,--geometry}'[window WIDTHxHEIGHT, in pixels (700x50)]:geometry:()' \ '(-s --server)'{-s,--server}'[run as server; open terminals by running footclient]:server:_files' \ diff --git a/doc/foot.1.scd b/doc/foot.1.scd index bedd541c..ccc0bd3c 100644 --- a/doc/foot.1.scd +++ b/doc/foot.1.scd @@ -36,6 +36,14 @@ execute (instead of the shell). *-t*,*--term*=_TERM_ Value to set the environment variable *TERM* to. Default: *foot*. +*--maximized* + Start in maximized mode. If both *--maximized* and *--fullscreen* + are specified, the _last_ one takes precedence. + +*--fullscreen* + Start in fullscreen mode. If both *--maximized* and *--fullscreen* + are specified, the _last_ one takes precedence. + *--login-shell* Start a login shell, by prepending a '-' to argv[0]. diff --git a/main.c b/main.c index b6ca0fa4..bf73c199 100644 --- a/main.c +++ b/main.c @@ -46,6 +46,8 @@ print_usage(const char *prog_name) " -c,--config=PATH load configuration from PATH (XDG_CONFIG_HOME/footrc)\n" " -f,--font=FONT comma separated list of fonts in fontconfig format (monospace)\n" " -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" " -g,--geometry=WIDTHxHEIGHT set initial width and height\n" " -s,--server[=PATH] run as a server (use 'footclient' to start terminals).\n" @@ -142,6 +144,8 @@ main(int argc, char *const *argv) {"geometry", required_argument, NULL, 'g'}, {"server", optional_argument, NULL, 's'}, {"hold", no_argument, NULL, 'H'}, + {"maximized", no_argument, NULL, 'm'}, + {"fullscreen", no_argument, NULL, 'F'}, {"presentation-timings", no_argument, NULL, 'P'}, /* Undocumented */ {"print-pid", required_argument, NULL, 'p'}, {"log-colorize", optional_argument, NULL, 'l'}, @@ -161,6 +165,8 @@ main(int argc, char *const *argv) const char *conf_server_socket_path = NULL; bool presentation_timings = false; bool hold = false; + bool maximized = false; + bool fullscreen = false; bool unlink_pid_file = false; const char *pid_file = NULL; enum log_colorize log_colorize = LOG_COLORIZE_AUTO; @@ -232,6 +238,16 @@ main(int argc, char *const *argv) hold = true; break; + case 'm': + maximized = true; + fullscreen = false; + break; + + case 'F': + fullscreen = true; + maximized = false; + break; + case 'p': pid_file = optarg; break; @@ -306,6 +322,10 @@ main(int argc, char *const *argv) free(conf.server_socket_path); conf.server_socket_path = strdup(conf_server_socket_path); } + if (maximized) + conf.startup_mode = STARTUP_MAXIMIZED; + else if (fullscreen) + conf.startup_mode = STARTUP_FULLSCREEN; conf.presentation_timings = presentation_timings; conf.hold_at_exit = hold;