]> git.lizzy.rs Git - bspwm.git/commitdiff
Restore the last window state with `node -t ~`
authorEmanuele Torre <torreemanuele6@gmail.com>
Sun, 31 Jan 2021 17:28:49 +0000 (18:28 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Fri, 28 May 2021 09:53:47 +0000 (11:53 +0200)
Closes #1253.

doc/bspwm.1
doc/bspwm.1.asciidoc
src/messages.c

index e798b23921d7176e30e08e761078f37ce23384aa..fa149775a50ec08b40f20fc426812348d27f2991 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 12/24/2020
+.\"      Date: 05/28/2021
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.10-18-g87822b5
+.\"    Source: Bspwm 0.9.10-25-g94c3c69
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "12/24/2020" "Bspwm 0\&.9\&.10\-18\-g87822b5" "Bspwm Manual"
+.TH "BSPWM" "1" "05/28/2021" "Bspwm 0\&.9\&.10\-25\-g94c3c69" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -738,11 +738,16 @@ Adjust the split ratios of the tree rooted at the selected node so that all wind
 Circulate the windows of the tree rooted at the selected node\&.
 .RE
 .PP
-\fB\-t\fR, \fB\-\-state\fR [~](tiled|pseudo_tiled|floating|fullscreen)
+\fB\-t\fR, \fB\-\-state\fR ~|[~]\fISTATE\fR
 .RS 4
 Set the state of the selected window\&. If
 \fB~\fR
-is present and the current state matches the given state, then the argument is interpreted as the last state\&.
+is present and the current state matches
+\fISTATE\fR, then the argument is interpreted as its last state\&. If the argument is just
+\fB~\fR
+with
+\fISTATE\fR
+omitted, then the state of the selected window is set to its last state\&.
 .RE
 .PP
 \fB\-g\fR, \fB\-\-flag\fR hidden|sticky|private|locked|marked[=on|off]
index ca504c27e63c266b1ef235cac2e6216a8b7da9c4..b5413ea6b635513fe25b74114d7f77cc8e8deaf4 100644 (file)
@@ -452,8 +452,8 @@ Commands
 *-C*, *--circulate* forward|backward::
        Circulate the windows of the tree rooted at the selected node.
 
-*-t*, *--state* [~](tiled|pseudo_tiled|floating|fullscreen)::
-       Set the state of the selected window. If *~* is present and the current state matches the given state, then the argument is interpreted as the last state.
+*-t*, *--state* \~|\[~]'STATE'::
+       Set the state of the selected window. If *\~* is present and the current state matches 'STATE', then the argument is interpreted as its last state. If the argument is just *~* with 'STATE' omitted, then the state of the selected window is set to its last state.
 
 *-g*, *--flag* hidden|sticky|private|locked|marked[=on|off]::
        Set or toggle the given flag for the selected node.
index d3852594bf1872ee7c6c97a690323bd37f5b3859..5b6e608ac7c2da96fe6da06f29eb173a6cdd4155 100644 (file)
@@ -296,20 +296,27 @@ void cmd_node(char **args, int num, FILE *rsp)
                                alternate = true;
                                (*args)++;
                        }
-                       if (parse_client_state(*args, &cst)) {
-                               if (alternate && trg.node != NULL && trg.node->client != NULL &&
-                                   trg.node->client->state == cst) {
+                       if (alternate && (*args)[0] == '\0') {
+                               if (trg.node != NULL && trg.node->client != NULL) {
                                        cst = trg.node->client->last_state;
-                               }
-                               if (!set_state(trg.monitor, trg.desktop, trg.node, cst)) {
+                               } else {
                                        fail(rsp, "");
                                        break;
                                }
-                               changed = true;
+                       } else if (parse_client_state(*args, &cst)) {
+                               if (alternate && trg.node != NULL && trg.node->client != NULL &&
+                                   trg.node->client->state == cst) {
+                                       cst = trg.node->client->last_state;
+                               }
                        } else {
                                fail(rsp, "node %s: Invalid argument: '%s'.\n", *(args - 1), *args);
                                break;
                        }
+                       if (!set_state(trg.monitor, trg.desktop, trg.node, cst)) {
+                               fail(rsp, "");
+                               break;
+                       }
+                       changed = true;
                } else if (streq("-g", *args) || streq("--flag", *args)) {
                        num--, args++;
                        if (num < 1) {