Add forgetful restart to sighandler

next
Axel Wagner 2010-12-30 21:43:34 +01:00 committed by Michael Stapelberg
parent 6ec468ba1e
commit aa422c07c4
4 changed files with 14 additions and 9 deletions

View File

@ -122,6 +122,6 @@ bool path_exists(const char *path);
* appends -a to argument list to disable autostart
*
*/
void i3_restart();
void i3_restart(bool forget_layout);
#endif

View File

@ -340,7 +340,7 @@ restart:
TOK_RESTART
{
printf("restarting i3\n");
i3_restart();
i3_restart(false);
}
;

View File

@ -40,11 +40,12 @@ static int raised_signal;
static char *crash_text[] = {
"i3 just crashed.",
"To debug this problem, either attach gdb now",
"or press 'e' to exit and get a core-dump.",
"If you want to keep your session,",
"press 'r' to restart i3 in-place."
"or press",
"- 'e' to exit and get a core-dump,",
"- 'r' to restart i3 in-place or",
"- 'f' to forget the current layout and restart"
};
static int crash_text_longest = 1;
static int crash_text_longest = 5;
/*
* Draw the window containing the info text
@ -99,7 +100,10 @@ static int sig_handle_key_press(void *ignored, xcb_connection_t *conn, xcb_key_p
}
if (sym == 'r')
i3_restart();
i3_restart(false);
if (sym == 'f')
i3_restart(true);
return 1;
}

View File

@ -321,8 +321,9 @@ char *store_restart_layout() {
* appends -a to argument list to disable autostart
*
*/
void i3_restart() {
char *restart_filename = store_restart_layout();
void i3_restart(bool forget_layout) {
char *restart_filename = forget_layout ? NULL : store_restart_layout();
restore_geometry();
ipc_shutdown();