const char *font;
const char *ipc_socket_path;
+ const char *restart_state_path;
int container_mode;
int container_stack_limit;
set[^\n]* { return TOKCOMMENT; }
ipc-socket { BEGIN(BIND_AWS_COND); return TOKIPCSOCKET; }
ipc_socket { BEGIN(BIND_AWS_COND); return TOKIPCSOCKET; }
+restart_state { BEGIN(BIND_AWS_COND); return TOKRESTARTSTATE; }
new_container { return TOKNEWCONTAINER; }
new_window { return TOKNEWWINDOW; }
focus_follows_mouse { return TOKFOCUSFOLLOWSMOUSE; }
%token TOKASSIGN "assign"
%token TOKSET
%token TOKIPCSOCKET "ipc_socket"
+%token TOKRESTARTSTATE "restart_state"
%token TOKEXEC "exec"
%token TOKSINGLECOLOR
%token TOKCOLOR
| workspace
| assign
| ipcsocket
+ | restart_state
| exec
| single_color
| color
}
;
+restart_state:
+ TOKRESTARTSTATE WHITESPACE STR
+ {
+ config.restart_state_path = $<string>3;
+ }
+ ;
+
exec:
TOKEXEC WHITESPACE STR
{
INIT_COLOR(config.bar.unfocused, "#333333", "#222222", "#888888");
INIT_COLOR(config.bar.urgent, "#2f343a", "#900000", "#ffffff");
+ config.restart_state_path = "~/.i3/_restart.json";
+
parse_configuration(override_configpath);
if (reload) {
*
*/
bool tree_restore() {
- char *globbed = resolve_tilde("~/.i3/_restart.json");
+ char *globbed = resolve_tilde(config.restart_state_path);
if (!path_exists(globbed)) {
LOG("%s does not exist, not restoring tree\n", globbed);
focused = croot;
tree_append_json(globbed);
- char *old_restart = resolve_tilde("~/.i3/_restart.json.old");
+
+ size_t path_len = strlen(config.restart_state_path);
+ char *old_restart = malloc(path_len + 5);
+ strncpy(old_restart, config.restart_state_path, path_len + 5);
+ strncat(old_restart, ".old", path_len + 5);
unlink(old_restart);
rename(globbed, old_restart);
free(globbed);
unsigned int length;
y(get_buf, &payload, &length);
- char *globbed = resolve_tilde("~/.i3/_restart.json");
+ char *globbed = resolve_tilde(config.restart_state_path);
int fd = open(globbed, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
free(globbed);
if (fd == -1) {