Codebase list herbstluftwm / de742a5
Add rule flag prepend Allow prepending of new rules instead of appending them to the list of rules. Thorsten Wißmann 10 years ago
4 changed file(s) with 12 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
22
33 Next Release
44 ------------
5
6 * new rule flag: prepend
57
68 Release 0.5.2 on 2013-06-23
79 ---------------------------
10961096 * +!+: same as +not+.
10971097 * +once+: only apply this rule once (and delete it afterwards).
10981098 * +printlabel+: prints the label of the newly created rule to stdout.
1099 * +prepend+: prepend the rule to the list of rules instead of appending it.
1100 So its consequences may be overwritten by already existing rules.
10991101
11001102 Examples:
11011103
1919 hc add "$tag"
2020
2121 # move next window from this process to this tag
22 hc rule maxage="$expire" pid="$$" tag="$tag" once
22 # prepend the rule so that it may be overwritten by existing custom rules e.g.
23 # in the autostart
24 hc rule prepend maxage="$expire" pid="$$" tag="$tag" once
2325
2426 exec "$@"
304304 // complete label
305305 try_complete_partial(needle, "label=", output);
306306 // complete flags
307 try_complete(needle, "prepend", output);
307308 try_complete(needle, "once", output);
308309 try_complete(needle, "not", output);
309310 try_complete(needle, "!", output);
430431 HSConsequence* cons;
431432 bool printlabel = false;
432433 bool negated = false;
434 bool prepend = false;
433435 struct {
434436 char* name;
435437 bool* flag;
436438 } flags[] = {
439 { "prepend",&prepend },
437440 { "not", &negated },
438441 { "!", &negated },
439442 { "once", &rule->once },
505508 g_string_append_printf(output, "%s\n", rule->label);
506509 }
507510
508 g_queue_push_tail(&g_rules, rule);
511 if (prepend) g_queue_push_head(&g_rules, rule);
512 else g_queue_push_tail(&g_rules, rule);
509513 return 0;
510514 }
511515