Add new restart_of_day action.

Same as restart but configuration file is loaded in full.
Unbound by default.

Closes #172
This commit is contained in:
Reginald Kennedy 2020-02-21 16:50:54 +08:00 committed by Marco Peereboom
parent 50ff69768e
commit dd7b85eaa2
2 changed files with 12 additions and 0 deletions

View file

@ -772,6 +772,8 @@ menu
quit
.It Cm M-q
restart
.It Aq Ar unbound
restart_of_day
.It Cm M- Ns Aq Cm Space
cycle_layout
.It Cm M-S-\e
@ -941,6 +943,10 @@ Quit
.It Cm restart
Restart
.Nm .
.It Cm restart_of_day
Same as
.Ic restart
but configuration file is loaded in full.
.It Cm cycle_layout
Cycle layout.
.It Cm flip_layout

View file

@ -711,6 +711,7 @@ union arg {
#define SWM_ARG_ID_CYCLERG_MOVE_DOWN (113)
#define SWM_ARG_ID_WS_EMPTY (120)
#define SWM_ARG_ID_WS_EMPTY_MOVE (121)
#define SWM_ARG_ID_RESTARTOFDAY (130)
char **argv;
};
@ -981,6 +982,7 @@ enum actionid {
FN_RESIZE,
FN_RESIZE_CENTERED,
FN_RESTART,
FN_RESTART_OF_DAY,
FN_RG_1,
FN_RG_2,
FN_RG_3,
@ -4258,6 +4260,9 @@ restart(struct binding *bp, struct swm_region *r, union arg *args)
shutdown_cleanup();
if (args->id == SWM_ARG_ID_RESTARTOFDAY)
unsetenv("SWM_STARTED");
execvp(start_argv[0], start_argv);
warn("execvp failed");
quit(NULL, NULL, NULL);
@ -8248,6 +8253,7 @@ struct action {
{ "resize", resize, FN_F_NOREPLAY, {.id = SWM_ARG_ID_DONTCENTER} },
{ "resize_centered", resize, FN_F_NOREPLAY, {.id = SWM_ARG_ID_CENTER} },
{ "restart", restart, 0, {0} },
{ "restart_of_day", restart, 0, {SWM_ARG_ID_RESTARTOFDAY} },
{ "rg_1", focusrg, 0, {.id = 0} },
{ "rg_2", focusrg, 0, {.id = 1} },
{ "rg_3", focusrg, 0, {.id = 2} },