sxhkd-rc

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

commit 6a9470fdf0a2041298ba9a1fa6beedd67008ed55
parent 3f3ae5106aed01ef0264053ce970ef34146ec9b4
Author: Bastien Dejean <nihilhill@gmail.com>
Date:   Tue, 28 Jul 2020 11:53:50 +0200

Make it build with GCC 10

Diffstat:
Msrc/parse.c | 3+++
Msrc/parse.h | 3---
Msrc/sxhkd.c | 24++++++++++++++++++++++++
Msrc/sxhkd.h | 40++++++++++++++++++++--------------------
Msrc/types.h | 5++---
5 files changed, 49 insertions(+), 26 deletions(-)

diff --git a/src/parse.c b/src/parse.c @@ -32,6 +32,9 @@ #include "locales.h" #include "parse.h" +xcb_keysym_t Alt_L, Alt_R, Super_L, Super_R, Hyper_L, Hyper_R, + Meta_L, Meta_R, Mode_switch, Num_Lock, Scroll_Lock; + keysym_dict_t nks_dict[] = {/*{{{*/ {"VoidSymbol" , 0xffffff} , #ifdef XK_MISCELLANY diff --git a/src/parse.h b/src/parse.h @@ -51,9 +51,6 @@ struct chunk_t { chunk_t *next; }; -xcb_keysym_t Alt_L, Alt_R, Super_L, Super_R, Hyper_L, Hyper_R, - Meta_L, Meta_R, Mode_switch, Num_Lock, Scroll_Lock; - void load_config(const char *config_file); void parse_event(xcb_generic_event_t *evt, uint8_t event_type, xcb_keysym_t *keysym, xcb_button_t *button, uint16_t *modfield); void process_hotkey(char *hotkey_string, char *command_string); diff --git a/src/sxhkd.c b/src/sxhkd.c @@ -36,6 +36,30 @@ #include "parse.h" #include "grab.h" +xcb_connection_t *dpy; +xcb_window_t root; +xcb_key_symbols_t *symbols; + +char *shell; +char config_file[MAXLEN]; +char *config_path; +char **extra_confs; +int num_extra_confs; +int redir_fd; +FILE *status_fifo; +char progress[3 * MAXLEN]; +int mapping_count; +int timeout; + +hotkey_t *hotkeys_head, *hotkeys_tail; +bool running, grabbed, toggle_grab, reload, bell, chained, locked; +xcb_keysym_t abort_keysym; +chord_t *abort_chord; + +uint16_t num_lock; +uint16_t caps_lock; +uint16_t scroll_lock; + int main(int argc, char *argv[]) { int opt; diff --git a/src/sxhkd.h b/src/sxhkd.h @@ -42,29 +42,29 @@ #define TIMEOUT_PREFIX 'T' #define TIMEOUT 3 -xcb_connection_t *dpy; -xcb_window_t root; -xcb_key_symbols_t *symbols; +extern xcb_connection_t *dpy; +extern xcb_window_t root; +extern xcb_key_symbols_t *symbols; -char *shell; -char config_file[MAXLEN]; -char *config_path; -char **extra_confs; -int num_extra_confs; -int redir_fd; -FILE *status_fifo; -char progress[3 * MAXLEN]; -int mapping_count; -int timeout; +extern char *shell; +extern char config_file[MAXLEN]; +extern char *config_path; +extern char **extra_confs; +extern int num_extra_confs; +extern int redir_fd; +extern FILE *status_fifo; +extern char progress[3 * MAXLEN]; +extern int mapping_count; +extern int timeout; -hotkey_t *hotkeys_head, *hotkeys_tail; -bool running, grabbed, toggle_grab, reload, bell, chained, locked; -xcb_keysym_t abort_keysym; -chord_t *abort_chord; +extern hotkey_t *hotkeys_head, *hotkeys_tail; +extern bool running, grabbed, toggle_grab, reload, bell, chained, locked; +extern xcb_keysym_t abort_keysym; +extern chord_t *abort_chord; -uint16_t num_lock; -uint16_t caps_lock; -uint16_t scroll_lock; +extern uint16_t num_lock; +extern uint16_t caps_lock; +extern uint16_t scroll_lock; void key_button_event(xcb_generic_event_t *evt, uint8_t event_type); void mapping_notify(xcb_generic_event_t *evt); diff --git a/src/types.h b/src/types.h @@ -34,6 +34,8 @@ #define ESCAPE_KEYSYM 0xff1b #define SYNCHRONOUS_CHAR ';' +extern xcb_keysym_t Mode_switch; + typedef struct chord_t chord_t; struct chord_t { char repr[MAXLEN]; @@ -73,9 +75,6 @@ typedef struct { xcb_keysym_t keysym; } keysym_dict_t; -xcb_keysym_t Alt_L, Alt_R, Super_L, Super_R, Hyper_L, Hyper_R, - Meta_L, Meta_R, Mode_switch, Num_Lock, Scroll_Lock; - hotkey_t *find_hotkey(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfield, uint8_t event_type, bool *replay_event); bool match_chord(chord_t *chord, uint8_t event_type, xcb_keysym_t keysym, xcb_button_t button, uint16_t modfield); chord_t *make_chord(xcb_keysym_t keysym, xcb_button_t button, uint16_t modfield, uint8_t event_type, bool replay_event, bool lock_chain);