diff options
| -rw-r--r-- | README.md | 5 | ||||
| -rw-r--r-- | config.c | 3 | ||||
| -rw-r--r-- | config.h | 1 | ||||
| -rw-r--r-- | keyboard.c | 9 | ||||
| -rw-r--r-- | main.c | 3 |
5 files changed, 16 insertions, 5 deletions
@@ -17,9 +17,10 @@ Q: What is an ENU? ## Configuration Create your config file at `XDG_CONFIG_HOME/swenu/conf.ini` or `HOME/.config/swenu/conf.ini`. -Example config file: +Example config: (hex colors also supported!) ```ini fancy_scroll = false +exit_on_focus_lost = true min_width = 500 font_size = 16 @@ -44,7 +45,7 @@ cursor_color = (0.9, 0.9, 0.9, 0.5) - [x] "prompt" - [x] fuzzy filter - [x] config file -- [ ] border, top padding in vertical and set exact height +- [ ] border, top padding and set exact height - [ ] unicode + text shaping Stretch: @@ -9,6 +9,7 @@ config_t config = { // default config .fancy_scroll = false, + .exit_on_focus_lost = true, .min_width = 500, .font_size = 16, .text_color = {0.85, 0.85, 0.85, 1.0}, @@ -108,6 +109,8 @@ static int our_ini_handler(void* user, const char* section, const char* name, co #define MATCH(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0 if (MATCH("", "fancy_scroll")) { config->fancy_scroll = parse_bool(value); + } else if (MATCH("", "exit_on_focus_lost")) { + config->exit_on_focus_lost = parse_bool(value); } else if (MATCH("", "min_width")) { config->min_width = atoi(value); } else if (MATCH("", "font_size")) { @@ -10,6 +10,7 @@ typedef struct { typedef struct { bool fancy_scroll; + bool exit_on_focus_lost; uint32_t min_width; uint32_t font_size; color_t text_color; @@ -2,6 +2,7 @@ #include <unistd.h> #include <locale.h> +#include "config.h" #include "state.h" #include "input_field.h" @@ -67,9 +68,11 @@ void wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, struct wl_surface *surface) { client_state *state = data; - // close on focus lost - state->running = false; - state->exit_code = EXIT_FAILURE; + // exit on focus lost + if (config.exit_on_focus_lost) { + state->running = false; + state->exit_code = EXIT_FAILURE; + } } void wl_keyboard_key(void *data, struct wl_keyboard *wl_keyboard, @@ -115,6 +115,9 @@ int main(int argc, char* argv[]) { wl_display_dispatch(state.display); } + // leak 8 bytes of memory + malloc(8); + // cleanup (of course) if (state.items) { array_for_all(item_t, item, state.items) { |
