Add forgetful restart to sighandler
This commit is contained in:
parent
6ec468ba1e
commit
aa422c07c4
|
@ -122,6 +122,6 @@ bool path_exists(const char *path);
|
||||||
* appends -a to argument list to disable autostart
|
* appends -a to argument list to disable autostart
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void i3_restart();
|
void i3_restart(bool forget_layout);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -340,7 +340,7 @@ restart:
|
||||||
TOK_RESTART
|
TOK_RESTART
|
||||||
{
|
{
|
||||||
printf("restarting i3\n");
|
printf("restarting i3\n");
|
||||||
i3_restart();
|
i3_restart(false);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,12 @@ static int raised_signal;
|
||||||
static char *crash_text[] = {
|
static char *crash_text[] = {
|
||||||
"i3 just crashed.",
|
"i3 just crashed.",
|
||||||
"To debug this problem, either attach gdb now",
|
"To debug this problem, either attach gdb now",
|
||||||
"or press 'e' to exit and get a core-dump.",
|
"or press",
|
||||||
"If you want to keep your session,",
|
"- 'e' to exit and get a core-dump,",
|
||||||
"press 'r' to restart i3 in-place."
|
"- '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
|
* 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')
|
if (sym == 'r')
|
||||||
i3_restart();
|
i3_restart(false);
|
||||||
|
|
||||||
|
if (sym == 'f')
|
||||||
|
i3_restart(true);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,8 +321,9 @@ char *store_restart_layout() {
|
||||||
* appends -a to argument list to disable autostart
|
* appends -a to argument list to disable autostart
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void i3_restart() {
|
void i3_restart(bool forget_layout) {
|
||||||
char *restart_filename = store_restart_layout();
|
char *restart_filename = forget_layout ? NULL : store_restart_layout();
|
||||||
|
|
||||||
restore_geometry();
|
restore_geometry();
|
||||||
|
|
||||||
ipc_shutdown();
|
ipc_shutdown();
|
||||||
|
|
Loading…
Reference in New Issue