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>
|
<refentrytitle>{mantitle}</refentrytitle>
|
||||||
<manvolnum>{manvolnum}</manvolnum>
|
<manvolnum>{manvolnum}</manvolnum>
|
||||||
<refmiscinfo class="source">i3</refmiscinfo>
|
<refmiscinfo class="source">i3</refmiscinfo>
|
||||||
<refmiscinfo class="version">alpha</refmiscinfo>
|
<refmiscinfo class="version">beta</refmiscinfo>
|
||||||
<refmiscinfo class="manual">i3 Manual</refmiscinfo>
|
<refmiscinfo class="manual">i3 Manual</refmiscinfo>
|
||||||
</refmeta>
|
</refmeta>
|
||||||
<refnamediv>
|
<refnamediv>
|
||||||
|
|
12
man/i3.man
12
man/i3.man
|
@ -1,7 +1,7 @@
|
||||||
i3(1)
|
i3(1)
|
||||||
=====
|
=====
|
||||||
Michael Stapelberg <michael+i3@stapelberg.de>
|
Michael Stapelberg <michael+i3@stapelberg.de>
|
||||||
v3.alpha-bf1, May 2009
|
v3.beta, May 2009
|
||||||
|
|
||||||
== NAME
|
== NAME
|
||||||
|
|
||||||
|
@ -9,7 +9,15 @@ i3 - an improved dynamic, tiling window manager
|
||||||
|
|
||||||
== SYNOPSIS
|
== SYNOPSIS
|
||||||
|
|
||||||
i3 [-c configfile]
|
i3 [-c configfile] [-a]
|
||||||
|
|
||||||
|
== OPTIONS
|
||||||
|
|
||||||
|
-c::
|
||||||
|
Specifies an alternate configuration file path
|
||||||
|
|
||||||
|
-a::
|
||||||
|
Disables autostart.
|
||||||
|
|
||||||
== DESCRIPTION
|
== 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
|
* 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. */
|
/* Is it <restart>? Then restart in place. */
|
||||||
if (STARTS_WITH(command, "restart")) {
|
if (STARTS_WITH(command, "restart")) {
|
||||||
LOG("restarting \"%s\"...\n", start_argv[0]);
|
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);
|
execvp(start_argv[0], start_argv);
|
||||||
/* not reached */
|
/* 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 main(int argc, char *argv[], char *env[]) {
|
||||||
int i, screens, opt;
|
int i, screens, opt;
|
||||||
char *override_configpath = NULL;
|
char *override_configpath = NULL;
|
||||||
|
bool autostart = true;
|
||||||
xcb_connection_t *conn;
|
xcb_connection_t *conn;
|
||||||
xcb_property_handlers_t prophs;
|
xcb_property_handlers_t prophs;
|
||||||
xcb_window_t root;
|
xcb_window_t root;
|
||||||
|
@ -85,8 +86,12 @@ int main(int argc, char *argv[], char *env[]) {
|
||||||
|
|
||||||
start_argv = argv;
|
start_argv = argv;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "c:v")) != -1) {
|
while ((opt = getopt(argc, argv, "c:va")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
case 'a':
|
||||||
|
LOG("Autostart disabled using -a\n");
|
||||||
|
autostart = false;
|
||||||
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
override_configpath = sstrdup(optarg);
|
override_configpath = sstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -270,9 +275,11 @@ int main(int argc, char *argv[], char *env[]) {
|
||||||
|
|
||||||
/* Autostarting exec-lines */
|
/* Autostarting exec-lines */
|
||||||
struct Autostart *exec;
|
struct Autostart *exec;
|
||||||
TAILQ_FOREACH(exec, &autostarts, autostarts) {
|
if (autostart) {
|
||||||
LOG("auto-starting %s\n", exec->command);
|
TAILQ_FOREACH(exec, &autostarts, autostarts) {
|
||||||
start_application(exec->command);
|
LOG("auto-starting %s\n", exec->command);
|
||||||
|
start_application(exec->command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for Xinerama */
|
/* check for Xinerama */
|
||||||
|
|
Loading…
Reference in New Issue