aboutsummaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-05-27 05:18:39 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-05-27 05:18:39 +0000
commit5639082113d839c2dee7fb7fc364afdf88aaa962 (patch)
treee9c76ebf5829b3f88a8885fc3952eff962f690b6 /client.c
parentslave: set IUTF8 (diff)
parentchangelog: mention addition of '--hold' to footclient (diff)
Merge branch 'hold-option-in-footclient'
This adds --hold to footclient. It was an oversight on my part to not add it from the beginning, when it was added to foot. Closes #17
Diffstat (limited to 'client.c')
-rw-r--r--client.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/client.c b/client.c
index 1458c7cd..0d0feb49 100644
--- a/client.c
+++ b/client.c
@@ -39,6 +39,7 @@ print_usage(const char *prog_name)
" --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"
+ " --hold remain open after child process exits\n"
" -l,--log-colorize=[never|always|auto] enable/disable colorization of log output on stderr\n"
" -v,--version show the version number and quit\n");
}
@@ -58,6 +59,7 @@ main(int argc, char *const *argv)
{"fullscreen", no_argument, NULL, 'F'},
{"login-shell", no_argument, NULL, 'L'},
{"server-socket", required_argument, NULL, 's'},
+ {"hold", no_argument, NULL, 'H'},
{"log-colorize", optional_argument, NULL, 'l'},
{"version", no_argument, NULL, 'v'},
{"help", no_argument, NULL, 'h'},
@@ -72,6 +74,7 @@ main(int argc, char *const *argv)
bool login_shell = false;
bool maximized = false;
bool fullscreen = false;
+ bool hold = false;
while (true) {
int c = getopt_long(argc, argv, "+:t:a:s:l::hv", longopts, NULL);
@@ -109,6 +112,10 @@ main(int argc, char *const *argv)
server_socket_path = optarg;
break;
+ case 'H':
+ hold = true;
+ break;
+
case 'l':
if (optarg == NULL || strcmp(optarg, "auto") == 0)
log_colorize = LOG_COLORIZE_AUTO;
@@ -212,6 +219,7 @@ main(int argc, char *const *argv)
total_len += sizeof(app_id_len) + app_id_len;
total_len += sizeof(uint8_t); /* maximized */
total_len += sizeof(uint8_t); /* fullscreen */
+ total_len += sizeof(uint8_t); /* hold */
total_len += sizeof(uint8_t); /* login_shell */
total_len += sizeof(argc);
@@ -266,6 +274,11 @@ main(int argc, char *const *argv)
goto err;
}
+ if (send(fd, &(uint8_t){hold}, sizeof(uint8_t), 0) != sizeof(uint8_t)) {
+ LOG_ERRNO("failed to send hold");
+ 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;