]> git.lizzy.rs Git - bspwm.git/commitdiff
Add `newest` descriptor and `marked` node flag
authorBastien Dejean <nihilhill@gmail.com>
Wed, 7 Mar 2018 11:01:58 +0000 (12:01 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Wed, 7 Mar 2018 11:01:58 +0000 (12:01 +0100)
16 files changed:
contrib/zsh_completion
doc/bspwm.1
doc/bspwm.1.asciidoc
examples/sxhkdrc
src/history.c
src/history.h
src/messages.c
src/parse.c
src/query.c
src/restore.c
src/rule.c
src/subscribe.c
src/tree.c
src/tree.h
src/types.h
src/window.c

index 8fec6c6b3e60ce844b003453ef9a706b49a99864..a32515f1eb33049616ff436173a927b2d0817c6a 100644 (file)
@@ -129,17 +129,17 @@ _bspc() {
        local -a commands=(node desktop monitor query rule wm subscribe config quit) \
                resize_handle=(top bottom top_left top_right bottom_left bottom_right left right) \
                node_state=(tiled pseudo_tiled floating fullscreen) \
-               flag=(hidden sticky private locked urgent) \
+               flag=(hidden sticky private locked marked urgent) \
                layer=(below normal above) \
                dir=(north west south east) \
                cycle_dir=(next prev)
        local -a jump=($dir first second brother parent 1 2) \
-               node_desc=($dir $cycle_dir last older newer focused pointed biggest) \
+               node_desc=($dir $cycle_dir last newest older newer focused pointed biggest) \
                node_mod=($node_state $flag $layer focused automatic local \
                active leaf window same_class descendant_of ancestor_of) \
-               desktop_desc=($cycle_dir last older newer focused) \
+               desktop_desc=($cycle_dir last newest older newer focused) \
                desktop_mod=(focused occupied local urgent) \
-               monitor_desc=($dir $cycle_dir primary last older newer focused pointed) \
+               monitor_desc=($dir $cycle_dir primary last newest older newer focused pointed) \
                monitor_mod=(focused occupied) \
                presel_dir=($dir cancel)
        local quote="${compstate[quote]}" context state state_descr line
index 9d2d3a5966f749db33b8c3cc62a5f09f58e1144c..ba2db7dfcde0d6fc26a4ffa43bdf48dd6fbc0f12 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 02/04/2018
+.\"      Date: 03/07/2018
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.3-47-ga5acc9a
+.\"    Source: Bspwm 0.9.3-52-gf83f7ef
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "02/04/2018" "Bspwm 0\&.9\&.3\-47\-ga5acc9a" "Bspwm Manual"
+.TH "BSPWM" "1" "03/07/2018" "Bspwm 0\&.9\&.3\-52\-gf83f7ef" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -100,7 +100,7 @@ Select a node\&.
 .RS 4
 .\}
 .nf
-NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|
+NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|newest|
                         older|newer|focused|pointed|
                         biggest|<node_id>)[\&.[!]focused][\&.[!]automatic][\&.[!]local][\&.[!]active]
                                           [\&.[!]leaf][\&.[!]window][\&.[!]STATE][\&.[!]FLAG][\&.[!]LAYER]
@@ -108,7 +108,7 @@ NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|
 
 STATE := tiled|pseudo_tiled|floating|fullscreen
 
-FLAG := hidden|sticky|private|locked|urgent
+FLAG := hidden|sticky|private|locked|marked|urgent
 
 LAYER := below|normal|above
 
@@ -148,6 +148,11 @@ last
 Selects the previously focused node relative to the reference node\&.
 .RE
 .PP
+newest
+.RS 4
+Selects the newest node in the history of the focused node\&.
+.RE
+.PP
 older
 .RS 4
 Selects the node older than the reference node in the history\&.
@@ -279,7 +284,7 @@ Only consider nodes that are or aren\(cqt descendants of the reference node\&.
 Only consider nodes that are or aren\(cqt ancestors of the reference node\&.
 .RE
 .PP
-[!](hidden|sticky|private|locked|urgent)
+[!](hidden|sticky|private|locked|marked|urgent)
 .RS 4
 Only consider windows that have or don\(cqt have the given flag set\&.
 .RE
@@ -297,7 +302,7 @@ Select a desktop\&.
 .RS 4
 .\}
 .nf
-DESKTOP_SEL := [DESKTOP_SEL#](CYCLE_DIR|last|older|newer|
+DESKTOP_SEL := [DESKTOP_SEL#](CYCLE_DIR|last|newest|older|newer|
                               [MONITOR_SEL:](focused|^<n>)|
                               <desktop_id>|<desktop_name>)[\&.[!]occupied][\&.[!]focused][\&.[!]urgent][\&.[!]local]
 .fi
@@ -323,6 +328,11 @@ last
 Selects the previously focused desktop relative to the reference desktop\&.
 .RE
 .PP
+newest
+.RS 4
+Selects the newest desktop in the history of the focused desktops\&.
+.RE
+.PP
 older
 .RS 4
 Selects the desktop older than the reference desktop in the history\&.
@@ -392,7 +402,7 @@ Select a monitor\&.
 .RS 4
 .\}
 .nf
-MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|older|newer|
+MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|newest|older|newer|
                               focused|pointed|primary|^<n>|
                               <monitor_id>|<monitor_name>)[\&.[!]occupied][\&.[!]focused]
 .fi
@@ -423,6 +433,11 @@ last
 Selects the previously focused monitor relative to the reference monitor\&.
 .RE
 .PP
+newest
+.RS 4
+Selects the newest monitor in the history of the focused monitors\&.
+.RE
+.PP
 older
 .RS 4
 Selects the monitor older than the reference monitor in the history\&.
@@ -527,6 +542,11 @@ Ignores the
 message\&.
 .RE
 .PP
+marked
+.RS 4
+Is marked (useful for deferred operations)\&.
+.RE
+.PP
 urgent
 .RS 4
 Has its urgency hint set\&. This flag is set externally\&.
@@ -674,7 +694,7 @@ 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\&.
 .RE
 .PP
-\fB\-g\fR, \fB\-\-flag\fR hidden|sticky|private|locked[=on|off]
+\fB\-g\fR, \fB\-\-flag\fR hidden|sticky|private|locked|marked[=on|off]
 .RS 4
 Set or toggle the given flag for the selected node\&.
 .RE
@@ -975,7 +995,7 @@ rule \fICOMMANDS\fR
 \fBCommands\fR
 .RS 4
 .PP
-\fB\-a\fR, \fB\-\-add\fR (<class_name>|*)[:(<instance_name>|*)] [\fB\-o\fR|\fB\-\-one\-shot\fR] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|node=NODE_SEL] [state=STATE] [layer=LAYER] [split_dir=DIR] [split_ratio=RATIO] [(hidden|sticky|private|locked|center|follow|manage|focus|border)=(on|off)] [rectangle=WxH+X+Y]
+\fB\-a\fR, \fB\-\-add\fR (<class_name>|*)[:(<instance_name>|*)] [\fB\-o\fR|\fB\-\-one\-shot\fR] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|node=NODE_SEL] [state=STATE] [layer=LAYER] [split_dir=DIR] [split_ratio=RATIO] [(hidden|sticky|private|locked|marked|center|follow|manage|focus|border)=(on|off)] [rectangle=WxH+X+Y]
 .RS 4
 Create a new rule\&.
 .RE
@@ -1418,7 +1438,7 @@ The geometry of a window changed\&.
 The state of a window changed\&.
 .RE
 .PP
-\fInode_flag <monitor_id> <desktop_id> <node_id> hidden|sticky|private|locked|urgent on|off\fR
+\fInode_flag <monitor_id> <desktop_id> <node_id> hidden|sticky|private|locked|marked|urgent on|off\fR
 .RS 4
 One of the flags of a node changed\&.
 .RE
index 329348ee6a7c29f0a468fedf97a638b3821ed3d3..acc2955996ee5b76cf71cdebe73755a2cff1fdd2 100644 (file)
@@ -74,7 +74,7 @@ Node
 Select a node.
 
 ----
-NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|
+NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|newest|
                         older|newer|focused|pointed|
                         biggest|<node_id>)[.[!]focused][.[!]automatic][.[!]local][.[!]active]
                                           [.[!]leaf][.[!]window][.[!]STATE][.[!]FLAG][.[!]LAYER]
@@ -82,7 +82,7 @@ NODE_SEL := [NODE_SEL#](DIR|CYCLE_DIR|PATH|last|
 
 STATE := tiled|pseudo_tiled|floating|fullscreen
 
-FLAG := hidden|sticky|private|locked|urgent
+FLAG := hidden|sticky|private|locked|marked|urgent
 
 LAYER := below|normal|above
 
@@ -106,6 +106,9 @@ Descriptors
 last::
        Selects the previously focused node relative to the reference node.
 
+newest::
+       Selects the newest node in the history of the focused node.
+
 older::
        Selects the node older than the reference node in the history.
 
@@ -177,7 +180,7 @@ Modifiers
 [!]ancestor_of::
        Only consider nodes that are or aren't ancestors of the reference node.
 
-[!](hidden|sticky|private|locked|urgent)::
+[!](hidden|sticky|private|locked|marked|urgent)::
        Only consider windows that have or don't have the given flag set.
 
 [!](below|normal|above)::
@@ -189,7 +192,7 @@ Desktop
 Select a desktop.
 
 ----
-DESKTOP_SEL := [DESKTOP_SEL#](CYCLE_DIR|last|older|newer|
+DESKTOP_SEL := [DESKTOP_SEL#](CYCLE_DIR|last|newest|older|newer|
                               [MONITOR_SEL:](focused|^<n>)|
                               <desktop_id>|<desktop_name>)[.[!]occupied][.[!]focused][.[!]urgent][.[!]local]
 ----
@@ -203,6 +206,9 @@ Descriptors
 last::
        Selects the previously focused desktop relative to the reference desktop.
 
+newest::
+       Selects the newest desktop in the history of the focused desktops.
+
 older::
        Selects the desktop older than the reference desktop in the history.
 
@@ -242,7 +248,7 @@ Monitor
 Select a monitor.
 
 ----
-MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|older|newer|
+MONITOR_SEL := [MONITOR_SEL#](DIR|CYCLE_DIR|last|newest|older|newer|
                               focused|pointed|primary|^<n>|
                               <monitor_id>|<monitor_name>)[.[!]occupied][.[!]focused]
 ----
@@ -259,6 +265,9 @@ Descriptors
 last::
        Selects the previously focused monitor relative to the reference monitor.
 
+newest::
+       Selects the newest monitor in the history of the focused monitors.
+
 older::
        Selects the monitor older than the reference monitor in the history.
 
@@ -325,6 +334,9 @@ private::
 locked::
        Ignores the *node --close* message.
 
+marked::
+       Is marked (useful for deferred operations).
+
 urgent::
        Has its urgency hint set. This flag is set externally.
 
@@ -408,7 +420,7 @@ Commands
 *-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.
 
-*-g*, *--flag* hidden|sticky|private|locked[=on|off]::
+*-g*, *--flag* hidden|sticky|private|locked|marked[=on|off]::
        Set or toggle the given flag for the selected node.
 
 *-l*, *--layer* below|normal|above::
@@ -574,7 +586,7 @@ rule 'COMMANDS'
 Commands
 ^^^^^^^^
 
-*-a*, *--add* (<class_name>|\*)[:(<instance_name>|\*)] [*-o*|*--one-shot*] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|node=NODE_SEL] [state=STATE] [layer=LAYER] [split_dir=DIR] [split_ratio=RATIO] [(hidden|sticky|private|locked|center|follow|manage|focus|border)=(on|off)] [rectangle=WxH+X+Y]::
+*-a*, *--add* (<class_name>|\*)[:(<instance_name>|\*)] [*-o*|*--one-shot*] [monitor=MONITOR_SEL|desktop=DESKTOP_SEL|node=NODE_SEL] [state=STATE] [layer=LAYER] [split_dir=DIR] [split_ratio=RATIO] [(hidden|sticky|private|locked|marked|center|follow|manage|focus|border)=(on|off)] [rectangle=WxH+X+Y]::
        Create a new rule.
 
 *-r*, *--remove* ^<n>|head|tail|(<class_name>|\*)[:(<instance_name>|*)]...::
@@ -831,7 +843,7 @@ Events
 'node_state <monitor_id> <desktop_id> <node_id> tiled|pseudo_tiled|floating|fullscreen on|off'::
        The state of a window changed.
 
-'node_flag <monitor_id> <desktop_id> <node_id> hidden|sticky|private|locked|urgent on|off'::
+'node_flag <monitor_id> <desktop_id> <node_id> hidden|sticky|private|locked|marked|urgent on|off'::
        One of the flags of a node changed.
 
 'node_layer <monitor_id> <desktop_id> <node_id> below|normal|above'::
index c3920973de32e43dccc3f0f9c440c330a3e7299e..84bd33a8aeda7e3b3458e42589ef81f014f1c210 100644 (file)
@@ -30,9 +30,9 @@ super + {_,shift + }w
 super + m
        bspc desktop -l next
 
-# if the current node is automatic, send it to the last manual, otherwise pull the last leaf
+# send the newest marked node to the newest preselected node
 super + y
-       bspc query -N -n focused.automatic && bspc node -n last.!automatic || bspc node last.leaf -n focused
+       bspc newest.marked.local -n newest.!automatic.local
 
 # swap the current node and the biggest node
 super + g
@@ -47,8 +47,8 @@ super + {t,shift + t,s,f}
        bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
 
 # set the node flags
-super + ctrl + {x,y,z}
-       bspc node -g {locked,sticky,private}
+super + ctrl + {m,x,y,z}
+       bspc node -g {marked,locked,sticky,private}
 
 #
 # focus/swap
index 640ce5ad499b455b5361b033c5ad5aa54220f811..d2e80d9668f9c66ef8dad516314d1e70c6cb028d 100644 (file)
@@ -148,6 +148,21 @@ monitor_t *history_last_monitor(monitor_t *m)
        return NULL;
 }
 
+bool history_find_newest_node(coordinates_t *ref, coordinates_t *dst, node_select_t sel)
+{
+       for (history_t *h = history_tail; h != NULL; h = h->prev) {
+               if (h->loc.node == NULL ||
+                   h->loc.node->hidden ||
+                   !node_matches(&h->loc, ref, sel)) {
+                       continue;
+               }
+               *dst = h->loc;
+               return true;
+       }
+
+       return false;
+}
+
 bool history_find_node(history_dir_t hdi, coordinates_t *ref, coordinates_t *dst, node_select_t sel)
 {
        if (history_needle == NULL || record_history) {
@@ -172,6 +187,18 @@ bool history_find_node(history_dir_t hdi, coordinates_t *ref, coordinates_t *dst
        return false;
 }
 
+bool history_find_newest_desktop(coordinates_t *ref, coordinates_t *dst, desktop_select_t sel)
+{
+       for (history_t *h = history_tail; h != NULL; h = h->prev) {
+               if (desktop_matches(&h->loc, ref, sel)) {
+                       *dst = h->loc;
+                       return true;
+               }
+       }
+
+       return false;
+}
+
 bool history_find_desktop(history_dir_t hdi, coordinates_t *ref, coordinates_t *dst, desktop_select_t sel)
 {
        if (history_needle == NULL || record_history) {
@@ -194,6 +221,18 @@ bool history_find_desktop(history_dir_t hdi, coordinates_t *ref, coordinates_t *
        return false;
 }
 
+bool history_find_newest_monitor(coordinates_t *ref, coordinates_t *dst, monitor_select_t sel)
+{
+       for (history_t *h = history_tail; h != NULL; h = h->prev) {
+               if (monitor_matches(&h->loc, ref, sel)) {
+                       *dst = h->loc;
+                       return true;
+               }
+       }
+
+       return false;
+}
+
 bool history_find_monitor(history_dir_t hdi, coordinates_t *ref, coordinates_t *dst, monitor_select_t sel)
 {
        if (history_needle == NULL || record_history) {
index 3ab35b9dd501d5c505002ac9707b354d28debe4f..8f832ca6e3d14abbaa03c813549339837d4956df 100644 (file)
@@ -34,8 +34,11 @@ void empty_history(void);
 node_t *history_last_node(desktop_t *d, node_t *n);
 desktop_t *history_last_desktop(monitor_t *m, desktop_t *d);
 monitor_t *history_last_monitor(monitor_t *m);
+bool history_find_newest_node(coordinates_t *ref, coordinates_t *dst, node_select_t sel);
 bool history_find_node(history_dir_t hdi, coordinates_t *ref, coordinates_t *dst, node_select_t sel);
+bool history_find_newest_desktop(coordinates_t *ref, coordinates_t *dst, desktop_select_t sel);
 bool history_find_desktop(history_dir_t hdi, coordinates_t *ref, coordinates_t *dst, desktop_select_t sel);
+bool history_find_newest_monitor(coordinates_t *ref, coordinates_t *dst, monitor_select_t sel);
 bool history_find_monitor(history_dir_t hdi, coordinates_t *ref, coordinates_t *dst, monitor_select_t sel);
 uint32_t history_rank(node_t *n);
 
index dd5228923c0fe4a708b5deb7aa6876b280621883..f6999acf0630037434094b3844f940527996ea7b 100644 (file)
@@ -342,6 +342,8 @@ void cmd_node(char **args, int num, FILE *rsp)
                                set_private(trg.monitor, trg.desktop, trg.node, (a == ALTER_SET ? b : !trg.node->private));
                        } else if (streq("locked", key)) {
                                set_locked(trg.monitor, trg.desktop, trg.node, (a == ALTER_SET ? b : !trg.node->locked));
+                       } else if (streq("marked", key)) {
+                               set_marked(trg.monitor, trg.desktop, trg.node, (a == ALTER_SET ? b : !trg.node->marked));
                        } else {
                                fail(rsp, "node %s: Invalid key: '%s'.\n", *(args - 1), key);
                                break;
index d307d6c66946fd3ba345066a3bbfa5ae5d5afdda..4ceb3a9fbc6b13b2e6f0e805faecec043478dc1d 100644 (file)
@@ -484,6 +484,7 @@ bool parse_node_modifiers(char *desc, node_select_t *sel)
                GET_MOD(sticky)
                GET_MOD(private)
                GET_MOD(locked)
+               GET_MOD(marked)
                GET_MOD(urgent)
                GET_MOD(same_class)
                GET_MOD(descendant_of)
index 950226a272851df750a28e0110d131b269f539cc..7dcdf38112502c976a1c48b1243246719f6f4249 100644 (file)
@@ -123,6 +123,7 @@ void query_node(node_t *n, FILE *rsp)
                fprintf(rsp, "\"sticky\":%s,", BOOL_STR(n->sticky));
                fprintf(rsp, "\"private\":%s,", BOOL_STR(n->private));
                fprintf(rsp, "\"locked\":%s,", BOOL_STR(n->locked));
+               fprintf(rsp, "\"marked\":%s,", BOOL_STR(n->marked));
                fprintf(rsp, "\"presel\":");
                query_presel(n->presel, rsp);
                fprintf(rsp,",");
@@ -391,13 +392,13 @@ void print_rule_consequence(char **buf, rule_consequence_t *csq)
                rect_buf = malloc(1);
                *rect_buf = '\0';
        }
-       asprintf(buf, "monitor=%s desktop=%s node=%s state=%s layer=%s split_dir=%s split_ratio=%lf hidden=%s sticky=%s private=%s locked=%s center=%s follow=%s manage=%s focus=%s border=%s rectangle=%s",
+       asprintf(buf, "monitor=%s desktop=%s node=%s state=%s layer=%s split_dir=%s split_ratio=%lf hidden=%s sticky=%s private=%s locked=%s marked=%s center=%s follow=%s manage=%s focus=%s border=%s rectangle=%s",
                csq->monitor_desc, csq->desktop_desc, csq->node_desc,
                csq->state == NULL ? "" : STATE_STR(*csq->state),
                csq->layer == NULL ? "" : LAYER_STR(*csq->layer),
                csq->split_dir, csq->split_ratio,
                ON_OFF_STR(csq->hidden), ON_OFF_STR(csq->sticky), ON_OFF_STR(csq->private),
-               ON_OFF_STR(csq->locked), ON_OFF_STR(csq->center), ON_OFF_STR(csq->follow),
+               ON_OFF_STR(csq->locked), ON_OFF_STR(csq->marked), ON_OFF_STR(csq->center), ON_OFF_STR(csq->follow),
                ON_OFF_STR(csq->manage), ON_OFF_STR(csq->focus), ON_OFF_STR(csq->border), rect_buf);
        free(rect_buf);
 }
@@ -426,6 +427,7 @@ node_select_t make_node_select(void)
                .sticky = OPTION_NONE,
                .private = OPTION_NONE,
                .locked = OPTION_NONE,
+               .marked = OPTION_NONE,
                .urgent = OPTION_NONE,
                .same_class = OPTION_NONE,
                .descendant_of = OPTION_NONE,
@@ -507,6 +509,8 @@ int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
                history_find_node(hdi, ref, dst, sel);
        } else if (streq("last", desc)) {
                history_find_node(HISTORY_OLDER, ref, dst, sel);
+       } else if (streq("newest", desc)) {
+               history_find_newest_node(ref, dst, sel);
        } else if (streq("biggest", desc)) {
                find_biggest(ref, dst, sel);
        } else if (streq("pointed", desc)) {
@@ -641,6 +645,8 @@ int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
                history_find_desktop(hdi, ref, dst, sel);
        } else if (streq("last", desc)) {
                history_find_desktop(HISTORY_OLDER, ref, dst, sel);
+       } else if (streq("newest", desc)) {
+               history_find_newest_desktop(ref, dst, sel);
        } else if (streq("focused", desc)) {
                coordinates_t loc = {mon, mon->desk, NULL};
                if (desktop_matches(&loc, ref, sel)) {
@@ -757,6 +763,8 @@ int monitor_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
                history_find_monitor(hdi, ref, dst, sel);
        } else if (streq("last", desc)) {
                history_find_monitor(HISTORY_OLDER, ref, dst, sel);
+       } else if (streq("newest", desc)) {
+               history_find_newest_monitor(ref, dst, sel);
        } else if (streq("primary", desc)) {
                if (pri_mon != NULL) {
                        coordinates_t loc = {pri_mon, NULL, NULL};
@@ -1002,6 +1010,7 @@ bool node_matches(coordinates_t *loc, coordinates_t *ref, node_select_t sel)
        NFLAG(sticky)
        NFLAG(private)
        NFLAG(locked)
+       NFLAG(marked)
 #undef NFLAG
 
        if (loc->node->client == NULL &&
index 94469d082078f762905cfb96df042e325d78ad11..c943a39c777835bcb2fdcbca0f59830789e35d66 100644 (file)
@@ -359,6 +359,7 @@ node_t *restore_node(jsmntok_t **t, char *json)
                        RESTORE_BOOL(sticky, &n->sticky)
                        RESTORE_BOOL(private, &n->private)
                        RESTORE_BOOL(locked, &n->locked)
+                       RESTORE_BOOL(marked, &n->marked)
                        } else if (keyeq("presel", *t, json)) {
                                (*t)++;
                                n->presel = restore_presel(t, json);
index e3e9778f1171717ec6d1b2bdfef40d1258fdd6dc..e4b11716c344f4dedd58f48bdbe86e66872a368d 100644 (file)
@@ -380,6 +380,7 @@ void parse_key_value(char *key, char *value, rule_consequence_t *csq)
                SETCSQ(sticky)
                SETCSQ(private)
                SETCSQ(locked)
+               SETCSQ(marked)
                SETCSQ(center)
                SETCSQ(follow)
                SETCSQ(manage)
index f9cd9a1132c76657cd8e8d7e155fab9e94614310..88aa353641bd7ddc0cd75f9d7c7b0de69e637cb1 100644 (file)
@@ -108,7 +108,7 @@ int print_report(FILE *stream)
                                        fprintf(stream, ":T@");
                                }
                                int i = 0;
-                               char flags[4];
+                               char flags[5];
                                if (n->sticky) {
                                        flags[i++] = 'S';
                                }
@@ -118,6 +118,9 @@ int print_report(FILE *stream)
                                if (n->locked) {
                                        flags[i++] = 'L';
                                }
+                               if (n->marked) {
+                                       flags[i++] = 'M';
+                               }
                                flags[i] = '\0';
                                fprintf(stream, ":G%s", flags);
                        }
index 822f27eaf56fbf82d9ec9b1c1b1b2c00ce182a27..d79e33b8aee2e0565b4842cf28d2ee55efb637c5 100644 (file)
@@ -418,6 +418,7 @@ node_t *insert_node(monitor_t *m, desktop_t *d, node_t *n, node_t *f)
                                d->root = c;
                        }
                        cancel_presel(m, d, f);
+                       set_marked(m, d, n, false);
                }
        }
 
@@ -660,7 +661,7 @@ node_t *make_node(uint32_t id)
        node_t *n = calloc(1, sizeof(node_t));
        n->id = id;
        n->parent = n->first_child = n->second_child = NULL;
-       n->vacant = n->hidden = n->sticky = n->private = n->locked = false;
+       n->vacant = n->hidden = n->sticky = n->private = n->locked = n->marked = false;
        n->split_ratio = split_ratio;
        n->split_type = TYPE_VERTICAL;
        n->birth_rotation = 0;
@@ -1933,6 +1934,21 @@ void set_locked(monitor_t *m, desktop_t *d, node_t *n, bool value)
        }
 }
 
+void set_marked(monitor_t *m, desktop_t *d, node_t *n, bool value)
+{
+       if (n == NULL || n->marked == value) {
+               return;
+       }
+
+       n->marked = value;
+
+       put_status(SBSC_MASK_NODE_FLAG, "node_flag 0x%08X 0x%08X 0x%08X marked %s\n", m->id, d->id, n->id, ON_OFF_STR(value));
+
+       if (n == m->desk->focus) {
+               put_status(SBSC_MASK_REPORT);
+       }
+}
+
 void set_urgent(monitor_t *m, desktop_t *d, node_t *n, bool value)
 {
        if (value && mon->desk->focus == n) {
index 7ba484b34ba13565a097da8847650bd04fadd72e..d9b5e61a6107480b6cd5a86bcfe8bcf636e05f0c 100644 (file)
@@ -106,6 +106,7 @@ void propagate_hidden_upward(monitor_t *m, desktop_t *d, node_t *n);
 void set_sticky(monitor_t *m, desktop_t *d, node_t *n, bool value);
 void set_private(monitor_t *m, desktop_t *d, node_t *n, bool value);
 void set_locked(monitor_t *m, desktop_t *d, node_t *n, bool value);
+void set_marked(monitor_t *m, desktop_t *d, node_t *n, bool value);
 void set_urgent(monitor_t *m, desktop_t *d, node_t *n, bool value);
 bool contains(xcb_rectangle_t a, xcb_rectangle_t b);
 xcb_rectangle_t get_rectangle(monitor_t *m, desktop_t *d, node_t *n);
index 6fa56c9ec97e60f3e16346fb6c7dea2d01b58a9d..712fdb8df5ccc19a74bdf246cc0d5fb7c985883b 100644 (file)
@@ -159,6 +159,7 @@ typedef struct {
        option_bool_t sticky;
        option_bool_t private;
        option_bool_t locked;
+       option_bool_t marked;
        option_bool_t urgent;
        option_bool_t same_class;
        option_bool_t descendant_of;
@@ -231,6 +232,7 @@ struct node_t {
        bool sticky;
        bool private;
        bool locked;
+       bool marked;
        node_t *first_child;
        node_t *second_child;
        node_t *parent;
@@ -334,6 +336,7 @@ typedef struct {
        bool sticky;
        bool private;
        bool locked;
+       bool marked;
        bool center;
        bool follow;
        bool manage;
index d1e8781e440fc80be5bebd2ec826ce873cbb2af6..7cfcd6ef807d1d74f5e322ef76de5fbb4109c4ea 100644 (file)
@@ -179,6 +179,7 @@ void manage_window(xcb_window_t win, rule_consequence_t *csq, int fd)
        set_sticky(m, d, n, csq->sticky);
        set_private(m, d, n, csq->private);
        set_locked(m, d, n, csq->locked);
+       set_marked(m, d, n, csq->marked);
 
        arrange(m, d);