Don’t process autostart when restarting (new parameter -a)
This commit is contained in:
parent
b58e2fa8ed
commit
94cead993c
|
@ -7,7 +7,7 @@ template::[header-declarations]
|
|||
<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>
|
||||
|
|
12
man/i3.man
12
man/i3.man
|
@ -1,7 +1,7 @@
|
|||
i3(1)
|
||||
=====
|
||||
Michael Stapelberg <michael+i3@stapelberg.de>
|
||||
v3.alpha-bf1, May 2009
|
||||
v3.beta, May 2009
|
||||
|
||||
== NAME
|
||||
|
||||
|
@ -9,7 +9,15 @@ i3 - an improved dynamic, tiling window manager
|
|||
|
||||
== SYNOPSIS
|
||||
|
||||
i3 [-c configfile]
|
||||
i3 [-c configfile] [-a]
|
||||
|
||||
== OPTIONS
|
||||
|
||||
-c::
|
||||
Specifies an alternate configuration file path
|
||||
|
||||
-a::
|
||||
Disables autostart.
|
||||
|
||||
== DESCRIPTION
|
||||
|
||||
|
|
|
@ -731,6 +731,29 @@ static void travel_focus_stack(xcb_connection_t *conn, const char *arguments) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
|
@ -763,6 +786,9 @@ void parse_command(xcb_connection_t *conn, const char *command) {
|
|||
/* 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 */
|
||||
}
|
||||
|
|
15
src/mainx.c
15
src/mainx.c
|
@ -72,6 +72,7 @@ int num_screens = 0;
|
|||
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;
|
||||
|
@ -85,8 +86,12 @@ int main(int argc, char *argv[], char *env[]) {
|
|||
|
||||
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;
|
||||
|
@ -270,9 +275,11 @@ int main(int argc, char *argv[], char *env[]) {
|
|||
|
||||
/* 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 */
|
||||
|
|
Loading…
Reference in New Issue