summaryrefslogtreecommitdiffstats
path: root/cmd-attach-session.c
diff options
context:
space:
mode:
authornicm <nicm>2020-05-16 15:45:29 +0000
committernicm <nicm>2020-05-16 15:45:29 +0000
commitcf9baddd6f844e8a26f1e7c59ba1c9eb3358571f (patch)
treee5297040b1538b4f41d786c1329b391880a36b76 /cmd-attach-session.c
parent469eda7e44fe6d502c976ebc34bbd97e6c6ed3e5 (diff)
Change the existing client flags for control mode to apply for any
client, use the same mechanism for the read-only flag and add an ignore-size flag. refresh-client -F has become -f (-F stays for backwards compatibility) and attach-session and switch-client now have -f flags also. A new format "client_flags" lists the flags and is shown by list-clients by default. This separates the read-only flag from "ignore size" behaviour (new ignore-size) flag - both behaviours are useful in different circumstances. attach -r and switchc -r remain and set or toggle both flags together.
Diffstat (limited to 'cmd-attach-session.c')
-rw-r--r--cmd-attach-session.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index 8c30c767..38d9c024 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -37,8 +37,9 @@ const struct cmd_entry cmd_attach_session_entry = {
.name = "attach-session",
.alias = "attach",
- .args = { "c:dErt:x", 0, 0 },
- .usage = "[-dErx] [-c working-directory] " CMD_TARGET_SESSION_USAGE,
+ .args = { "c:dEf:rt:x", 0, 0 },
+ .usage = "[-dErx] [-c working-directory] [-f flags] "
+ CMD_TARGET_SESSION_USAGE,
/* -t is special */
@@ -48,7 +49,7 @@ const struct cmd_entry cmd_attach_session_entry = {
enum cmd_retval
cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
- int xflag, int rflag, const char *cflag, int Eflag)
+ int xflag, int rflag, const char *cflag, int Eflag, const char *fflag)
{
struct cmd_find_state *current = cmdq_get_current(item);
struct cmd_find_state target;
@@ -101,6 +102,10 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
free((void *)s->cwd);
s->cwd = format_single(item, cflag, c, s, wl, wp);
}
+ if (fflag)
+ server_client_set_flags(c, fflag);
+ if (rflag)
+ c->flags |= (CLIENT_READONLY|CLIENT_IGNORESIZE);
c->last_session = c->session;
if (c->session != NULL) {
@@ -135,8 +140,6 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
free(cause);
return (CMD_RETURN_ERROR);
}
- if (rflag)
- c->flags |= CLIENT_READONLY;
if (dflag || xflag) {
if (xflag)
@@ -182,5 +185,5 @@ cmd_attach_session_exec(struct cmd *self, struct cmdq_item *item)
return (cmd_attach_session(item, args_get(args, 't'),
args_has(args, 'd'), args_has(args, 'x'), args_has(args, 'r'),
- args_get(args, 'c'), args_has(args, 'E')));
+ args_get(args, 'c'), args_has(args, 'E'), args_get(args, 'f')));
}