mirror of
https://github.com/vale981/bspwm
synced 2025-03-05 18:01:37 -05:00
Keep current setting value on syntax error
This commit is contained in:
parent
f158b4aecd
commit
49de0d6e94
5 changed files with 18 additions and 9 deletions
|
@ -54,7 +54,7 @@
|
|||
## Planned Features
|
||||
|
||||
- Directional focus movement.
|
||||
- Float individual windows (it means there will be a floating layer).
|
||||
- Float individual windows.
|
||||
- Resize and move floating windows with the keyboard.
|
||||
- Resize and move floating windows on a regular magnetic grid (the granularity of the grid might be related to GCD(screen\_width, screen\_height)).
|
||||
- Double window borders. Rationale: with single borders, it might happen that the color of the window border is too close to the color of the window content to be visible.
|
||||
|
|
2
events.c
2
events.c
|
@ -14,7 +14,7 @@ void handle_event(xcb_generic_event_t *evt)
|
|||
PUTS("received a map request\n");
|
||||
break;
|
||||
case XCB_UNGRAB_KEY:
|
||||
PUTS("ungrab key received");
|
||||
/* PUTS("ungrab key received"); */
|
||||
break;
|
||||
case XCB_KEY_PRESS:
|
||||
PUTS("keypress received");
|
||||
|
|
|
@ -26,8 +26,10 @@ char *string_expr(lua_State *L, char *expr, char* fallback)
|
|||
if (eval_expr(L, expr) == 0) {
|
||||
if (lua_isstring(L, -1))
|
||||
result = strdup(lua_tostring(L, -1));
|
||||
else
|
||||
else if (fallback != NULL)
|
||||
result = strdup(fallback);
|
||||
else
|
||||
result = NULL;
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -26,6 +26,4 @@ void process_message(char *msg, char *rsp)
|
|||
}
|
||||
|
||||
lua_close(L);
|
||||
|
||||
/* strcpy(rsp, "hello\n"); */
|
||||
}
|
||||
|
|
17
settings.c
17
settings.c
|
@ -1,3 +1,5 @@
|
|||
#define _BSD_SOURCE
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -73,7 +75,7 @@ void get_setting(lua_State *L, char* rsp)
|
|||
|
||||
void set_setting(lua_State *L)
|
||||
{
|
||||
char *name;
|
||||
char *name, *backup;
|
||||
|
||||
if (!has_table(L, "set"))
|
||||
return;
|
||||
|
@ -84,12 +86,19 @@ void set_setting(lua_State *L)
|
|||
return;
|
||||
|
||||
if (strcmp(name, "inner_border_width") == 0) {
|
||||
inner_border_width = int_expr(L, "set.value", INNER_BORDER_WIDTH);
|
||||
inner_border_width = int_expr(L, "set.value", inner_border_width);
|
||||
} else if (strcmp(name, "normal_border_color") == 0) {
|
||||
backup = strdup(normal_border_color);
|
||||
free(normal_border_color);
|
||||
normal_border_color = string_expr(L, "set.value", NORMAL_BORDER_COLOR);
|
||||
normal_border_color = string_expr(L, "set.value", backup);
|
||||
} else if (strcmp(name, "inner_border_color") == 0) {
|
||||
backup = strdup(inner_border_color);
|
||||
free(inner_border_color);
|
||||
inner_border_color = string_expr(L, "set.value", INNER_BORDER_COLOR);
|
||||
inner_border_color = string_expr(L, "set.value", backup);
|
||||
} else if (strcmp(name, "smart_surroundings") == 0) {
|
||||
smart_surroundings = bool_expr(L, "set.value", smart_surroundings);
|
||||
}
|
||||
|
||||
if (backup != NULL)
|
||||
free(backup);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue