list_windows
Return the list of managed windows (i.e. their identifiers).
+ list_rules
+ Return the list of rules.
+
presel left|right|up|down [SPLIT_RATIO]
Switch to manual mode and select the splitting direction.
.BI list_windows
Return the list of managed windows (i.e. their identifiers).
.TP
+.BI list_rules
+Return the list of rules.
+.TP
.BI presel " left|right|up|down [SPLIT_RATIO]"
Switch to manual mode and select the splitting direction.
.TP
xcb_ewmh_set_supported(ewmh, default_screen, LENGTH(net_atoms), net_atoms);
- monitor_uid = desktop_uid = client_uid = 0;
+ monitor_uid = desktop_uid = client_uid = rule_uid = 0;
mon = last_mon = mon_head = mon_tail = NULL;
bool xinerama_is_active = false;
ewmh_update_number_of_desktops();
ewmh_update_desktop_names();
ewmh_update_current_desktop();
- rule_head = make_rule();
+ rule_head = rule_tail = NULL;
frozen_pointer = make_pointer_state();
get_pointer_position(&pointer_position);
last_entered = XCB_NONE;
unsigned int monitor_uid;
unsigned int desktop_uid;
unsigned int client_uid;
+unsigned int rule_uid;
xcb_screen_t *screen;
uint8_t root_depth;
FILE *status_fifo;
monitor_t *mon_head;
monitor_t *mon_tail;
rule_t *rule_head;
+rule_t *rule_tail;
pointer_state_t *frozen_pointer;
xcb_point_t pointer_position;
xcb_window_t last_entered;
#include "helpers.h"
#include "window.h"
#include "tree.h"
+#include "rules.h"
void process_message(char *msg, char *rsp)
{
} else if (strcmp(cmd, "list_windows") == 0) {
list_windows(rsp);
return;
+ } else if (strcmp(cmd, "list_rules") == 0) {
+ list_rules(rsp);
+ return;
} else if (strcmp(cmd, "close") == 0) {
window_close(mon->desk->focus);
return;
}
arg = strtok(NULL, TOK_SEP);
}
- rule->next = rule_head;
- rule_head = rule;
+ add_rule(rule);
}
return;
} else if (strcmp(cmd, "alternate") == 0) {
#include "ewmh.h"
#include "rules.h"
+void add_rule(rule_t *r)
+{
+ if (rule_head == NULL) {
+ rule_head = rule_tail = r;
+ } else {
+ rule_tail->next = r;
+ r->prev = rule_tail;
+ rule_tail = r;
+ }
+}
+
bool is_match(rule_t *r, xcb_window_t win)
{
xcb_icccm_get_wm_class_reply_t reply;
rule = rule->next;
}
}
+
+void list_rules(char *rsp)
+{
+ char line[MAXLEN];
+
+ for (rule_t *r = rule_head; r != NULL; r = r->next) {
+ snprintf(line, sizeof(line), "%03X %s %s %s\n", r->uid, r->cause.name, (r->effect.desktop != NULL ? r->effect.desktop->name : "\b"), (r->effect.floating ? "floating" : "\b"));
+ strncat(rsp, line, REMLEN(rsp));
+ }
+}
#ifndef _RULES_H
#define _RULES_H
+void add_rule(rule_t *);
bool is_match(rule_t *, xcb_window_t);
void handle_rules(xcb_window_t, monitor_t **, desktop_t **, bool *, bool *, bool *, bool *, bool *);
+void list_rules(char *);
#endif
rule_t *make_rule(void)
{
rule_t *r = malloc(sizeof(rule_t));
+ r->uid = ++rule_uid;
r->effect.floating = false;
r->effect.monitor = NULL;
r->effect.desktop = NULL;
typedef struct rule_t rule_t;
struct rule_t {
+ unsigned int uid;
rule_cause_t cause;
rule_effect_t effect;
+ rule_t *prev;
rule_t *next;
};