aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2020-09-29 15:22:06 +0200
committerOmar Polo <op@omarpolo.com>2020-09-29 15:27:41 +0200
commit9f53ba9bae9aee077aa72cbc3fb5af6d27d20ec2 (patch)
tree7712bd4735277c779f4f08736d49f2c47869d294
parentfe0dcf4e2d945f528e2af9cbfc9d8eadb3b571bd (diff)
downloadstar-platinum-9f53ba9bae9aee077aa72cbc3fb5af6d27d20ec2.tar.gz
star-platinum-9f53ba9bae9aee077aa72cbc3fb5af6d27d20ec2.tar.bz2
add ``match *'' to match everything
Rationale: sometimes it can be useful to globally bind a key. For instance, some users may like to bind on "C-<Up>" do "<Page_Up>" for every application.
-rw-r--r--lex.l1
-rw-r--r--parse.y3
-rw-r--r--star-platinum.c3
-rw-r--r--star-platinum.h3
4 files changed, 8 insertions, 2 deletions
diff --git a/lex.l b/lex.l
index b02ff03..4e5955a 100644
--- a/lex.l
+++ b/lex.l
@@ -53,6 +53,7 @@ KeySym key = 0;
"ignore" return TIGNORE;
"\n" yylineno++; return '\n';
+"*" return '*';
[-a-zA-Z0-9]+ {
char *ident;
diff --git a/parse.y b/parse.y
index 0c76c3c..38d035c 100644
--- a/parse.y
+++ b/parse.y
@@ -72,7 +72,8 @@ matches : /* empty */ { $$ = NULL; }
| matches match '\n' { $2->next = $1; $$ = $2; }
;
-match : TMATCH TCLASS TSTRING { $$ = new_match(MCLASS, $3); }
+match : TMATCH '*' { $$ = new_match(MANY, NULL); }
+ | TMATCH TCLASS TSTRING { $$ = new_match(MCLASS, $3); }
;
keys : /* empty */ { $$ = NULL; }
diff --git a/star-platinum.c b/star-platinum.c
index 4deaff2..94e035c 100644
--- a/star-platinum.c
+++ b/star-platinum.c
@@ -366,6 +366,9 @@ int
match_window(struct match *m, Window w)
{
switch (m->prop) {
+ case MANY:
+ return 1;
+
case MCLASS:
return window_match_class(w, m->str);
break;
diff --git a/star-platinum.h b/star-platinum.h
index 7949d62..4ed031b 100644
--- a/star-platinum.h
+++ b/star-platinum.h
@@ -49,7 +49,8 @@ struct action {
void do_action(struct action, Window, int);
struct match {
-#define MCLASS 1
+#define MANY 1
+#define MCLASS 2
int prop;
char *str;
struct match *next;