mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-19 05:33:44 -04:00
commit
a5f3aa1278
6 changed files with 68 additions and 13 deletions
|
|
@ -72,6 +72,8 @@ means foot can be PGO:d in e.g. sandboxed build scripts. See
|
||||||
implements foot's old font sizing behavior. But, when **disabled**,
|
implements foot's old font sizing behavior. But, when **disabled**,
|
||||||
foot will ignore the monitors' DPI and instead size fonts using the
|
foot will ignore the monitors' DPI and instead size fonts using the
|
||||||
scale factor alone (https://codeberg.org/dnkl/foot/issues/206).
|
scale factor alone (https://codeberg.org/dnkl/foot/issues/206).
|
||||||
|
* `-w,--window-size-pixels` and `-W,--window-size-chars` command line
|
||||||
|
options to `footclient`.
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ struct client_argv {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct client_data {
|
struct client_data {
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
uint8_t size_type:1; // Values correspond to enum conf_size_type
|
||||||
uint8_t maximized:1;
|
uint8_t maximized:1;
|
||||||
uint8_t fullscreen:1;
|
uint8_t fullscreen:1;
|
||||||
uint8_t hold:1;
|
uint8_t hold:1;
|
||||||
|
|
|
||||||
52
client.c
52
client.c
|
|
@ -37,6 +37,8 @@ print_usage(const char *prog_name)
|
||||||
printf(" -t,--term=TERM value to set the environment variable TERM to (foot)\n"
|
printf(" -t,--term=TERM value to set the environment variable TERM to (foot)\n"
|
||||||
" --title=TITLE initial window title (foot)\n"
|
" --title=TITLE initial window title (foot)\n"
|
||||||
" -a,--app-id=ID window application ID (foot)\n"
|
" -a,--app-id=ID window application ID (foot)\n"
|
||||||
|
" -w,--window-size-pixels=WIDTHxHEIGHT initial width and height, in pixels\n"
|
||||||
|
" -W,--window-size-chars=WIDTHxHEIGHT initial width and height, in characters\n"
|
||||||
" --maximized start in maximized mode\n"
|
" --maximized start in maximized mode\n"
|
||||||
" --fullscreen start in fullscreen mode\n"
|
" --fullscreen start in fullscreen mode\n"
|
||||||
" --login-shell start shell as a login shell\n"
|
" --login-shell start shell as a login shell\n"
|
||||||
|
|
@ -54,23 +56,28 @@ main(int argc, char *const *argv)
|
||||||
const char *const prog_name = argv[0];
|
const char *const prog_name = argv[0];
|
||||||
|
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
{"term", required_argument, NULL, 't'},
|
{"term", required_argument, NULL, 't'},
|
||||||
{"title", required_argument, NULL, 'T'},
|
{"title", required_argument, NULL, 'T'},
|
||||||
{"app-id", required_argument, NULL, 'a'},
|
{"app-id", required_argument, NULL, 'a'},
|
||||||
{"maximized", no_argument, NULL, 'm'},
|
{"window-size-pixels", required_argument, NULL, 'w'},
|
||||||
{"fullscreen", no_argument, NULL, 'F'},
|
{"window-size-chars", required_argument, NULL, 'W'},
|
||||||
{"login-shell", no_argument, NULL, 'L'},
|
{"maximized", no_argument, NULL, 'm'},
|
||||||
{"server-socket", required_argument, NULL, 's'},
|
{"fullscreen", no_argument, NULL, 'F'},
|
||||||
{"hold", no_argument, NULL, 'H'},
|
{"login-shell", no_argument, NULL, 'L'},
|
||||||
{"log-colorize", optional_argument, NULL, 'l'},
|
{"server-socket", required_argument, NULL, 's'},
|
||||||
{"version", no_argument, NULL, 'v'},
|
{"hold", no_argument, NULL, 'H'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"log-colorize", optional_argument, NULL, 'l'},
|
||||||
{NULL, no_argument, NULL, 0},
|
{"version", no_argument, NULL, 'v'},
|
||||||
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
{NULL, no_argument, NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *term = "";
|
const char *term = "";
|
||||||
const char *title = "";
|
const char *title = "";
|
||||||
const char *app_id = "";
|
const char *app_id = "";
|
||||||
|
unsigned size_type = 0; // enum conf_size_type (without pulling in tllist/fcft via config.h)
|
||||||
|
unsigned width = 0;
|
||||||
|
unsigned height = 0;
|
||||||
const char *server_socket_path = NULL;
|
const char *server_socket_path = NULL;
|
||||||
enum log_colorize log_colorize = LOG_COLORIZE_AUTO;
|
enum log_colorize log_colorize = LOG_COLORIZE_AUTO;
|
||||||
bool login_shell = false;
|
bool login_shell = false;
|
||||||
|
|
@ -79,7 +86,7 @@ main(int argc, char *const *argv)
|
||||||
bool hold = false;
|
bool hold = false;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int c = getopt_long(argc, argv, "+t:T:a:mFLs:Hl::vh", longopts, NULL);
|
int c = getopt_long(argc, argv, "+t:T:a:w:W:mFLs:Hl::vh", longopts, NULL);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -100,6 +107,22 @@ main(int argc, char *const *argv)
|
||||||
login_shell = true;
|
login_shell = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'w':
|
||||||
|
if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
||||||
|
fprintf(stderr, "error: invalid window-size-pixels: %s\n", optarg);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
size_type = 0; // CONF_SIZE_PX
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'W':
|
||||||
|
if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
||||||
|
fprintf(stderr, "error: invalid window-size-chars: %s\n", optarg);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
size_type = 1; // CONF_SIZE_CELLS
|
||||||
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
maximized = true;
|
maximized = true;
|
||||||
fullscreen = false;
|
fullscreen = false;
|
||||||
|
|
@ -215,6 +238,9 @@ main(int argc, char *const *argv)
|
||||||
const size_t app_id_len = strlen(app_id) + 1;
|
const size_t app_id_len = strlen(app_id) + 1;
|
||||||
|
|
||||||
const struct client_data data = {
|
const struct client_data data = {
|
||||||
|
.width = width,
|
||||||
|
.height = height,
|
||||||
|
.size_type = size_type,
|
||||||
.maximized = maximized,
|
.maximized = maximized,
|
||||||
.fullscreen = fullscreen,
|
.fullscreen = fullscreen,
|
||||||
.hold = hold,
|
.hold = hold,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ _arguments \
|
||||||
'--maximized[start in maximized mode]' \
|
'--maximized[start in maximized mode]' \
|
||||||
'--fullscreen[start in fullscreen mode]' \
|
'--fullscreen[start in fullscreen mode]' \
|
||||||
'--login-shell[start shell as a login shell]' \
|
'--login-shell[start shell as a login shell]' \
|
||||||
|
'(-w --window-size-pixels)'{-w,--window-size-pixels}'[window WIDTHxHEIGHT, in pixels (700x500)]:size_pixels:()' \
|
||||||
|
'(-W --window-size-chars)'{-W,--window-size-chars}'[window WIDTHxHEIGHT, in characters (not set)]:size_chars:()' \
|
||||||
'(-s --server-socket)'{-s,--server-socket}'[override the default path to the foot server socket ($XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock)]:server:_files' \
|
'(-s --server-socket)'{-s,--server-socket}'[override the default path to the foot server socket ($XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock)]:server:_files' \
|
||||||
'--hold[remain open after child process exits]' \
|
'--hold[remain open after child process exits]' \
|
||||||
'(-l --log-colorize)'{-l,--log-colorize}'[enable or disable colorization of log output on stderr]:logcolor:(never always auto)' \
|
'(-l --log-colorize)'{-l,--log-colorize}'[enable or disable colorization of log output on stderr]:logcolor:(never always auto)' \
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,12 @@ terminal has terminated).
|
||||||
Value to set the *app-id* property on the Wayland window
|
Value to set the *app-id* property on the Wayland window
|
||||||
to. Default: _foot_.
|
to. Default: _foot_.
|
||||||
|
|
||||||
|
*-w*,*--window-size-pixels*=_WIDTHxHEIGHT_
|
||||||
|
Set initial window width and height, in pixels. Default: _700x500_.
|
||||||
|
|
||||||
|
*-W*,*--window-size-chars*=_WIDTHxHEIGHT_
|
||||||
|
Set initial window width and height, in characters. Default: _not set_.
|
||||||
|
|
||||||
*--maximized*
|
*--maximized*
|
||||||
Start in maximized mode. If both *--maximized* and *--fullscreen*
|
Start in maximized mode. If both *--maximized* and *--fullscreen*
|
||||||
are specified, the _last_ one takes precedence.
|
are specified, the _last_ one takes precedence.
|
||||||
|
|
|
||||||
16
server.c
16
server.c
|
|
@ -263,6 +263,22 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data)
|
||||||
else if (cdata.fullscreen)
|
else if (cdata.fullscreen)
|
||||||
client->conf.startup_mode = STARTUP_FULLSCREEN;
|
client->conf.startup_mode = STARTUP_FULLSCREEN;
|
||||||
|
|
||||||
|
if (cdata.width > 0 && cdata.height > 0) {
|
||||||
|
client->conf.size.type = cdata.size_type;
|
||||||
|
|
||||||
|
switch (cdata.size_type) {
|
||||||
|
case CONF_SIZE_PX:
|
||||||
|
client->conf.size.px.width = cdata.width;
|
||||||
|
client->conf.size.px.height = cdata.height;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CONF_SIZE_CELLS:
|
||||||
|
client->conf.size.cells.width = cdata.width;
|
||||||
|
client->conf.size.cells.height = cdata.height;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
client->term = term_init(
|
client->term = term_init(
|
||||||
&client->conf, server->fdm, server->reaper, server->wayl,
|
&client->conf, server->fdm, server->reaper, server->wayl,
|
||||||
"footclient", cwd, cdata.argc, argv, &term_shutdown_handler, client);
|
"footclient", cwd, cdata.argc, argv, &term_shutdown_handler, client);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue