Implement restart-command to restart i3 without having to end your session
This commit is contained in:
parent
2bcf7b32d7
commit
10c5702a78
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#define NUM_ATOMS 9
|
#define NUM_ATOMS 9
|
||||||
|
|
||||||
|
extern char *application_path;
|
||||||
extern Display *xkbdpy;
|
extern Display *xkbdpy;
|
||||||
extern TAILQ_HEAD(bindings_head, Binding) bindings;
|
extern TAILQ_HEAD(bindings_head, Binding) bindings;
|
||||||
extern SLIST_HEAD(stack_wins_head, Stack_Window) stack_wins;
|
extern SLIST_HEAD(stack_wins_head, Stack_Window) stack_wins;
|
||||||
|
|
|
@ -347,6 +347,13 @@ void parse_command(xcb_connection_t *conn, const char *command) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Is it <restart>? */
|
||||||
|
if (strncmp(command, "restart", strlen("restart")) == 0) {
|
||||||
|
printf("restarting \"%s\"...\n", application_path);
|
||||||
|
execl(application_path, application_path, NULL);
|
||||||
|
/* not reached */
|
||||||
|
}
|
||||||
|
|
||||||
/* Is it 'f' for fullscreen? */
|
/* Is it 'f' for fullscreen? */
|
||||||
if (command[0] == 'f') {
|
if (command[0] == 'f') {
|
||||||
if (CUR_CELL->currently_focused == NULL)
|
if (CUR_CELL->currently_focused == NULL)
|
||||||
|
|
|
@ -44,6 +44,9 @@
|
||||||
#include "xinerama.h"
|
#include "xinerama.h"
|
||||||
#include "i3.h"
|
#include "i3.h"
|
||||||
|
|
||||||
|
/* This is the path to i3, copied from argv[0] when starting up */
|
||||||
|
char *application_path;
|
||||||
|
|
||||||
/* This is our connection to X11 for use with XKB */
|
/* This is our connection to X11 for use with XKB */
|
||||||
Display *xkbdpy;
|
Display *xkbdpy;
|
||||||
|
|
||||||
|
@ -279,6 +282,8 @@ int main(int argc, char *argv[], char *env[]) {
|
||||||
xcb_window_t root;
|
xcb_window_t root;
|
||||||
xcb_intern_atom_cookie_t atom_cookies[NUM_ATOMS];
|
xcb_intern_atom_cookie_t atom_cookies[NUM_ATOMS];
|
||||||
|
|
||||||
|
application_path = sstrdup(argv[0]);
|
||||||
|
|
||||||
/* Initialize the table data structures for each workspace */
|
/* Initialize the table data structures for each workspace */
|
||||||
init_table();
|
init_table();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue