diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-07-28 23:04:29 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-07-28 23:04:29 +0000 |
commit | d9dcc5ed44a5cc9f0129af3d2f444c043bcf1ab7 (patch) | |
tree | fe7fa5faedc6253859f0feaab36519c8a10ff0ba /cmd-select-layout.c | |
parent | 1c73e759821dc41ff39ac81b7396913beed41ca0 (diff) | |
download | rtmux-d9dcc5ed44a5cc9f0129af3d2f444c043bcf1ab7.tar.gz rtmux-d9dcc5ed44a5cc9f0129af3d2f444c043bcf1ab7.tar.bz2 rtmux-d9dcc5ed44a5cc9f0129af3d2f444c043bcf1ab7.zip |
Sync OpenBSD patchset 191:
If select-layout is not given an argument, reapply the last layout used in the
window, if any.
Diffstat (limited to 'cmd-select-layout.c')
-rw-r--r-- | cmd-select-layout.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/cmd-select-layout.c b/cmd-select-layout.c index 0e0cd199..c2401017 100644 --- a/cmd-select-layout.c +++ b/cmd-select-layout.c @@ -1,4 +1,4 @@ -/* $Id: cmd-select-layout.c,v 1.7 2009-07-28 22:12:16 tcunha Exp $ */ +/* $Id: cmd-select-layout.c,v 1.8 2009-07-28 23:04:29 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -29,8 +29,8 @@ int cmd_select_layout_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_select_layout_entry = { "select-layout", "selectl", - CMD_TARGET_WINDOW_USAGE " layout-name", - CMD_ARG1, 0, + CMD_TARGET_WINDOW_USAGE " [layout-name]", + CMD_ARG01, 0, cmd_select_layout_init, cmd_target_parse, cmd_select_layout_exec, @@ -72,11 +72,15 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_ctx *ctx) if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL) return (-1); - if ((layout = layout_set_lookup(data->arg)) == -1) { - ctx->error(ctx, "unknown or ambiguous layout: %s", data->arg); - return (-1); - } - + if (data->arg == NULL) { + layout = wl->window->lastlayout; + if (layout == -1) + return (0); + } else if ((layout = layout_set_lookup(data->arg)) == -1) { + ctx->error(ctx, "unknown layout or ambiguous: %s", data->arg); + return (-1); + } + layout = layout_set_select(wl->window, layout); ctx->info(ctx, "arranging in: %s", layout_set_name(layout)); |