]> git.sur5r.net Git - i3/i3/commitdiff
patch to allow exec_always in configure file
authorClaudio Marforio <marforio@gmail.com>
Tue, 12 Jul 2011 10:24:01 +0000 (12:24 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 12 Jul 2011 16:23:14 +0000 (18:23 +0200)
fixed indentation, updated docs

docs/userguide
include/data.h
include/i3.h
src/cfgparse.l
src/cfgparse.y
src/main.c

index 60d8d63dba962c21e69775b6f5c2016ed0de6792..eb916a863add59d5938f4cdd5ad2dd0e74e124ee 100644 (file)
@@ -469,18 +469,22 @@ use it, it has to be a UTF-8 encoded arrow, not `->` or something like that.
 
 === Automatically starting applications on i3 startup
 
-By using the +exec+ keyword outside a keybinding, you can configure which
-commands will be performed by i3 on initial startup (not when restarting i3
-in-place however). These commands will be run in order.
+By using the +exec+ keyword outside a keybinding, you can configure
+which commands will be performed by i3 on initial startup. +exec+
+commands will not run when restarting i3, if you need a command to run
+also when restarting i3 you should use the +exec_always+
+keyword. These commands will be run in order.
 
 *Syntax*:
-------------
+-------------------
 exec command
-------------
+exec_always command
+-------------------
 
 *Examples*:
 --------------------------------
 exec i3status | dzen2 -dock
+exec_always ~/my_script.sh
 --------------------------------
 
 [[workspace_screen]]
index fed4420cab949d744a33aa79487aa5377b31325d..4dc379c2cd727452a6a8b0d7c936d9e0592ff60c 100644 (file)
@@ -174,13 +174,17 @@ struct Binding {
 };
 
 /**
- * Holds a command specified by an exec-line in the config (see src/config.c)
+ * Holds a command specified by either an:
+ * - exec-line
+ * - exec_always-line
+ * in the config (see src/config.c)
  *
  */
 struct Autostart {
     /** Command, like in command mode */
     char *command;
     TAILQ_ENTRY(Autostart) autostarts;
+    TAILQ_ENTRY(Autostart) autostarts_always;
 };
 
 /**
index 73b61178dfd633e7c0ef9d46c578fa8592f5a92a..c54e3c3328478b680fc1278a3c9db9783fdaab73 100644 (file)
@@ -26,6 +26,7 @@ extern Display *xlibdpy, *xkbdpy;
 extern int xkb_current_group;
 extern TAILQ_HEAD(bindings_head, Binding) *bindings;
 extern TAILQ_HEAD(autostarts_head, Autostart) autostarts;
+extern TAILQ_HEAD(autostarts_always_head, Autostart) autostarts_always;
 extern TAILQ_HEAD(ws_assignments_head, Workspace_Assignment) ws_assignments;
 extern TAILQ_HEAD(assignments_head, Assignment) assignments;
 extern SLIST_HEAD(stack_wins_head, Stack_Window) stack_wins;
index 9194fbe618559b2813cc12eb34d775ca12cbeb23..2e1d240af58bf21a76e5f5e3e75f2b720c4ee422 100644 (file)
@@ -147,6 +147,7 @@ stack-limit                     { return TOKSTACKLIMIT; }
 cols                            { /* yylval.number = STACK_LIMIT_COLS; */return TOKSTACKLIMIT; }
 rows                            { /* yylval.number = STACK_LIMIT_ROWS; */return TOKSTACKLIMIT; }
 exec                            { WS_STRING; return TOKEXEC; }
+exec_always                     { WS_STRING; return TOKEXEC_ALWAYS; }
 client.background               { BEGIN(COLOR_COND); yylval.single_color = &config.client.background; return TOKSINGLECOLOR; }
 client.focused                  { BEGIN(COLOR_COND); yylval.color = &config.client.focused; return TOKCOLOR; }
 client.focused_inactive         { BEGIN(COLOR_COND); yylval.color = &config.client.focused_inactive; return TOKCOLOR; }
index 09201c71370bedc4dedede449ccf7fa60d7ca0ba..a3aea46f42de143f5737887f9be08143a2c00153 100644 (file)
@@ -518,6 +518,7 @@ void parse_file(const char *f) {
 %token                  TOKIPCSOCKET                "ipc_socket"
 %token                  TOKRESTARTSTATE             "restart_state"
 %token                  TOKEXEC                     "exec"
+%token                  TOKEXEC_ALWAYS              "exec_always"
 %token  <single_color>  TOKSINGLECOLOR
 %token  <color>         TOKCOLOR
 %token                  TOKARROW                    "→"
@@ -590,6 +591,7 @@ line:
     | ipcsocket
     | restart_state
     | exec
+    | exec_always
     | single_color
     | color
     | terminal
@@ -1036,6 +1038,15 @@ exec:
     }
     ;
 
+exec_always:
+    TOKEXEC_ALWAYS STR
+    {
+        struct Autostart *new = smalloc(sizeof(struct Autostart));
+        new->command = $2;
+        TAILQ_INSERT_TAIL(&autostarts_always, new, autostarts_always);
+    }
+    ;
+
 terminal:
     TOKTERMINAL STR
     {
index 7910c8b1a6655c51b391e54e3a58a69ee6a16ecb..3ef394a27e3ce120cc76358235457d0ee404bc85 100644 (file)
@@ -32,6 +32,9 @@ struct bindings_head *bindings;
 /* The list of exec-lines */
 struct autostarts_head autostarts = TAILQ_HEAD_INITIALIZER(autostarts);
 
+/* The list of exec_always lines */
+struct autostarts_always_head autostarts_always = TAILQ_HEAD_INITIALIZER(autostarts_always);
+
 /* The list of assignments */
 struct assignments_head assignments = TAILQ_HEAD_INITIALIZER(assignments);
 
@@ -465,5 +468,12 @@ int main(int argc, char *argv[]) {
         }
     }
 
+    /* Autostarting exec_always-lines */
+    struct Autostart *exec_always;
+    TAILQ_FOREACH(exec_always, &autostarts_always, autostarts_always) {
+        LOG("auto-starting (always!) %s\n", exec_always->command);
+        start_application(exec_always->command);
+    }
+
     ev_loop(main_loop, 0);
 }