1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/** Copyright 2011-2013 Thorsten Wißmann. All rights reserved.
*
* This software is licensed under the "Simplified BSD License".
* See LICENSE for details */
#ifndef __HS_RULES_H_
#define __HS_RULES_H_
#include <stdbool.h>
#include <regex.h>
#include "glib-backports.h"
struct HSClient;
struct HSTag;
enum {
CONDITION_VALUE_TYPE_STRING,
CONDITION_VALUE_TYPE_REGEX,
CONDITION_VALUE_TYPE_INTEGER,
};
enum {
CONSEQUENCE_VALUE_TYPE_STRING,
};
typedef struct {
int condition_type;
int value_type;
bool negated;
union {
char* str;
struct {
regex_t exp;
char* str;
} reg;
int integer;
} value;
} HSCondition;
typedef struct {
int type;
int value_type;
union {
char* str;
} value;
} HSConsequence;
typedef struct {
char* label;
HSCondition** conditions;
int condition_count;
HSConsequence** consequences;
int consequence_count;
bool once;
time_t birth_time; // timestamp of at creation
} HSRule;
typedef struct {
GString* tag_name;
GString* monitor_name;
GString* tree_index;
bool focus; // if client should get focus
bool switchtag; // if the tag may be switched for focusing it
bool manage; // whether we should manage it
bool fullscreen;
bool ewmhnotify; // whether to send ewmh-notifications
GString* keymask; // Which keymask rule should be applied for this client
} HSClientChanges;
void rules_init();
void rules_destroy();
void rules_apply(struct HSClient* client, HSClientChanges* changes);
void client_changes_init(HSClientChanges* changes, struct HSClient* client);
void client_changes_free_members(HSClientChanges* changes);
HSRule* rule_create();
void rule_destroy(HSRule* rule);
void rule_complete(int argc, char** argv, int pos, GString* output);
int rule_add_command(int argc, char** argv, GString* output);
int rule_remove_command(int argc, char** argv, GString* output);
int rule_print_all_command(int argc, char** argv, GString* output);
void complete_against_rule_names(int argc, char** argv, int pos, GString* output);
#endif
|