Add rule flag prepend
Allow prepending of new rules instead of appending them to the list of
rules.
Thorsten Wißmann
10 years ago
2 | 2 |
|
3 | 3 |
Next Release
|
4 | 4 |
------------
|
|
5 |
|
|
6 |
* new rule flag: prepend
|
5 | 7 |
|
6 | 8 |
Release 0.5.2 on 2013-06-23
|
7 | 9 |
---------------------------
|
1096 | 1096 |
* +!+: same as +not+.
|
1097 | 1097 |
* +once+: only apply this rule once (and delete it afterwards).
|
1098 | 1098 |
* +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.
|
1099 | 1101 |
|
1100 | 1102 |
Examples:
|
1101 | 1103 |
|
19 | 19 |
hc add "$tag"
|
20 | 20 |
|
21 | 21 |
# 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
|
23 | 25 |
|
24 | 26 |
exec "$@"
|
304 | 304 |
// complete label
|
305 | 305 |
try_complete_partial(needle, "label=", output);
|
306 | 306 |
// complete flags
|
|
307 |
try_complete(needle, "prepend", output);
|
307 | 308 |
try_complete(needle, "once", output);
|
308 | 309 |
try_complete(needle, "not", output);
|
309 | 310 |
try_complete(needle, "!", output);
|
|
430 | 431 |
HSConsequence* cons;
|
431 | 432 |
bool printlabel = false;
|
432 | 433 |
bool negated = false;
|
|
434 |
bool prepend = false;
|
433 | 435 |
struct {
|
434 | 436 |
char* name;
|
435 | 437 |
bool* flag;
|
436 | 438 |
} flags[] = {
|
|
439 |
{ "prepend",&prepend },
|
437 | 440 |
{ "not", &negated },
|
438 | 441 |
{ "!", &negated },
|
439 | 442 |
{ "once", &rule->once },
|
|
505 | 508 |
g_string_append_printf(output, "%s\n", rule->label);
|
506 | 509 |
}
|
507 | 510 |
|
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);
|
509 | 513 |
return 0;
|
510 | 514 |
}
|
511 | 515 |
|