]> git.sur5r.net Git - i3/i3/commitdiff
lexer/parser: implement 'border' command
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 12 Nov 2010 17:41:54 +0000 (18:41 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 12 Nov 2010 17:41:54 +0000 (18:41 +0100)
include/data.h
src/cmdparse.l
src/cmdparse.y

index 3d32a396e3bfe37f081a8571fc111c9ced92d820..ae499126d1c5a8f03a174a33f1cd1c68f6d783dd 100644 (file)
@@ -316,6 +316,7 @@ struct Con {
 
     enum { CF_NONE = 0, CF_OUTPUT = 1, CF_GLOBAL = 2 } fullscreen_mode;
     enum { L_DEFAULT = 0, L_STACKED = 1, L_TABBED = 2 } layout;
+    enum { BS_NORMAL = 0, BS_NONE = 1, BS_1PIXEL = 3 } border_style;
     /** floating? (= not in tiling layout) This cannot be simply a bool
      * because we want to keep track of whether the status was set by the
      * application (by setting _NET_WM_WINDOW_TYPE appropriately) or by the
index 3b3aefe2fdb4cf594ff673f7f633a53d4b447f5f..9a236efc3cc7a08ddb1871ad3cccc6cc3f5cc783 100644 (file)
@@ -91,6 +91,7 @@ stacked                         { return TOK_STACKED; }
 stacking                        { return TOK_STACKED; }
 tabbed                          { return TOK_TABBED; }
 border                          { return TOK_BORDER; }
+normal                          { return TOK_NORMAL; }
 none                            { return TOK_NONE; }
 1pixel                          { return TOK_1PIXEL; }
 mode                            { return TOK_MODE; }
index 5dba6f59e1b732b3a5a332a56ade328c07b30808..a4ed00bb1a59d22e0dcfd821c76ad40a4a46cab1 100644 (file)
@@ -109,6 +109,7 @@ char *parse_cmd(const char *new) {
 %token TOK_STACKED "stacked"
 %token TOK_TABBED "tabbed"
 %token TOK_BORDER "border"
+%token TOK_NORMAL "normal"
 %token TOK_NONE "none"
 %token TOK_1PIXEL "1pixel"
 %token TOK_MODE "mode"
@@ -284,8 +285,7 @@ operation:
     | exit
     | restart
     | reload
-    /*
-    | border */
+    | border
     | layout
     | restore
     | move
@@ -479,6 +479,31 @@ window_mode:
     | TOK_TOGGLE    { $<number>$ = TOK_TOGGLE; }
     ;
 
+border:
+    TOK_BORDER WHITESPACE border_style
+    {
+        printf("border style should be changed to %d\n", $<number>3);
+        owindow *current;
+
+        /* check if the match is empty, not if the result is empty */
+        if (match_is_empty(&current_match))
+            focused->border_style = $<number>3;
+        else {
+            TAILQ_FOREACH(current, &owindows, owindows) {
+                printf("matching: %p / %s\n", current->con, current->con->name);
+                current->con->border_style = $<number>3;
+            }
+        }
+    }
+    ;
+
+border_style:
+    TOK_NORMAL      { $<number>$ = BS_NORMAL; }
+    | TOK_NONE      { $<number>$ = BS_NONE; }
+    | TOK_1PIXEL    { $<number>$ = BS_1PIXEL; }
+    ;
+
+
 level:
     TOK_LEVEL WHITESPACE level_direction
     {