<refentrytitle>{mantitle}</refentrytitle>
<manvolnum>{manvolnum}</manvolnum>
<refmiscinfo class="source">i3</refmiscinfo>
-<refmiscinfo class="version">alpha</refmiscinfo>
+<refmiscinfo class="version">beta</refmiscinfo>
<refmiscinfo class="manual">i3 Manual</refmiscinfo>
</refmeta>
<refnamediv>
i3(1)
=====
Michael Stapelberg <michael+i3@stapelberg.de>
-v3.alpha-bf1, May 2009
+v3.beta, May 2009
== NAME
== SYNOPSIS
-i3 [-c configfile]
+i3 [-c configfile] [-a]
+
+== OPTIONS
+
+-c::
+Specifies an alternate configuration file path
+
+-a::
+Disables autostart.
== DESCRIPTION
}
}
+/*
+ * Goes through the list of arguments (for exec()) and checks if the given argument
+ * is present. If not, it copies the arguments (because we cannot realloc it) and
+ * appends the given argument.
+ *
+ */
+static char **append_argument(char **original, char *argument) {
+ int num_args;
+ for (num_args = 0; original[num_args] != NULL; num_args++) {
+ LOG("original argument: \"%s\"\n", original[num_args]);
+ /* If the argument is already present we return the original pointer */
+ if (strcmp(original[num_args], argument) == 0)
+ return original;
+ }
+ /* Copy the original array */
+ char **result = smalloc((num_args+2) * sizeof(char*));
+ memcpy(result, original, num_args * sizeof(char*));
+ result[num_args] = argument;
+ result[num_args+1] = NULL;
+
+ return result;
+}
+
/*
* Parses a command, see file CMDMODE for more information
*
/* Is it <restart>? Then restart in place. */
if (STARTS_WITH(command, "restart")) {
LOG("restarting \"%s\"...\n", start_argv[0]);
+ /* make sure -a is in the argument list or append it */
+ start_argv = append_argument(start_argv, "-a");
+
execvp(start_argv[0], start_argv);
/* not reached */
}
int main(int argc, char *argv[], char *env[]) {
int i, screens, opt;
char *override_configpath = NULL;
+ bool autostart = true;
xcb_connection_t *conn;
xcb_property_handlers_t prophs;
xcb_window_t root;
start_argv = argv;
- while ((opt = getopt(argc, argv, "c:v")) != -1) {
+ while ((opt = getopt(argc, argv, "c:va")) != -1) {
switch (opt) {
+ case 'a':
+ LOG("Autostart disabled using -a\n");
+ autostart = false;
+ break;
case 'c':
override_configpath = sstrdup(optarg);
break;
/* Autostarting exec-lines */
struct Autostart *exec;
- TAILQ_FOREACH(exec, &autostarts, autostarts) {
- LOG("auto-starting %s\n", exec->command);
- start_application(exec->command);
+ if (autostart) {
+ TAILQ_FOREACH(exec, &autostarts, autostarts) {
+ LOG("auto-starting %s\n", exec->command);
+ start_application(exec->command);
+ }
}
/* check for Xinerama */