sxhkd-rc

[fork] simple X hotkey daemon (but for the rc shell)
Log | Files | Refs | README | LICENSE

commit 0847f5b171bf4dc5be27e282004f3eba1e353ef0
parent 339463767600629ae5786089d354ce114fe08bfc
Author: Bastien Dejean <nihilhill@gmail.com>
Date:   Fri, 21 Jun 2013 14:03:58 +0200

Keep order of configuration in hotkeys

Diffstat:
Mhotkeys.c | 8++++++--
Msxhkd.c | 4++--
Msxhkd.h | 4++--
3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/hotkeys.c b/hotkeys.c @@ -2872,6 +2872,10 @@ hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfiel void add_hotkey(hotkey_t *hk) { - hk->next = hotkeys; - hotkeys = hk; + if (hotkeys == NULL) { + hotkeys = hotkeys_tail = hk; + } else { + hotkeys_tail->next = hk; + hotkeys_tail = hk; + } } diff --git a/sxhkd.c b/sxhkd.c @@ -38,7 +38,7 @@ void setup(void) if ((shell = getenv(SXHKD_SHELL_ENV)) == NULL && (shell = getenv(SHELL_ENV)) == NULL) err("The '%s' environment variable is not defined.\n", SHELL_ENV); symbols = xcb_key_symbols_alloc(dpy); - hotkeys = NULL; + hotkeys = hotkeys_tail = NULL; } void cleanup(void) @@ -51,6 +51,7 @@ void cleanup(void) free(hk); hk = tmp; } + hotkeys = hotkeys_tail = NULL; } void destroy_chain(chain_t *chain) @@ -73,7 +74,6 @@ void reload_cmd(void) { PUTS("reload"); cleanup(); - hotkeys = NULL; load_config(config_file); for (int i = 0; i < num_extra_confs; i++) load_config(extra_confs[i]); diff --git a/sxhkd.h b/sxhkd.h @@ -40,9 +40,8 @@ struct hotkey_t { xcb_connection_t *dpy; xcb_window_t root; xcb_key_symbols_t *symbols; -char *shell; -hotkey_t *hotkeys; +char *shell; char config_file[MAXLEN]; char *config_path; char **extra_confs; @@ -50,6 +49,7 @@ int num_extra_confs; int redir_fd; int timeout; +hotkey_t *hotkeys, *hotkeys_tail; bool running, reload, bell, chained; uint16_t num_lock;