criteria: Add keyboard shortcuts inhibitor selector

Add a criteria selector that allows to match presence and state of
keyboard shortcuts inhibitors on views. This allows to give visual
feedback to the user on the state of an inhibitor through e.g.:

for_window [shortcuts_inhibitor=inactive] title_format !-%title
for_window [shortcuts_inhibitor=active] title_format !+%title
for_window [shortcuts_inhibitor=present] title_format !%title
for_window [shortcuts_inhibitor=absent] title_format %title

Beware: present in the example above overrides inactive and active
criteria because when active or inactive an inhbitor is obviously
present. Ordering does matter here.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
This commit is contained in:
Michael Weiser 2020-03-12 23:45:06 +01:00
parent aa48b926be
commit 224576afcc
3 changed files with 79 additions and 1 deletions

View file

@ -24,6 +24,14 @@ struct pattern {
pcre *regex;
};
enum criteria_keyboard_shortcuts_inhibitor {
// implicit: C_KEYBOARD_SHORTCUTS_INHIBITOR_UNSPEC = 0,
C_KEYBOARD_SHORTCUTS_INHIBITOR_PRESENT = 1,
C_KEYBOARD_SHORTCUTS_INHIBITOR_ABSENT,
C_KEYBOARD_SHORTCUTS_INHIBITOR_ACTIVE,
C_KEYBOARD_SHORTCUTS_INHIBITOR_INACTIVE,
};
struct criteria {
enum criteria_type type;
char *raw; // entire criteria string (for logging)
@ -47,6 +55,7 @@ struct criteria {
char urgent; // 'l' for latest or 'o' for oldest
struct pattern *workspace;
pid_t pid;
enum criteria_keyboard_shortcuts_inhibitor keyboard_shortcuts_inhibitor;
};
bool criteria_is_empty(struct criteria *criteria);