sxhkd-rc

[fork] simple X hotkey daemon (but for the rc shell)
git clone https://hhvn.uk/sxhkd-rc
git clone git://hhvn.uk/sxhkd-rc
Log | Files | Refs | README | LICENSE

sxhkd.h (2777B)


      1 /* Copyright (c) 2013, Bastien Dejean
      2  * All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions are met:
      6  *
      7  * 1. Redistributions of source code must retain the above copyright notice, this
      8  *    list of conditions and the following disclaimer.
      9  * 2. Redistributions in binary form must reproduce the above copyright notice,
     10  *    this list of conditions and the following disclaimer in the documentation
     11  *    and/or other materials provided with the distribution.
     12  *
     13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
     14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     16  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
     17  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     20  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     22  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     23  */
     24 
     25 #ifndef SXHKD_SXHKD_H
     26 #define SXHKD_SXHKD_H
     27 
     28 #include <xcb/xcb_keysyms.h>
     29 #include <stdio.h>
     30 #include <stdbool.h>
     31 #include "types.h"
     32 #include "helpers.h"
     33 
     34 #define CONFIG_HOME_ENV     "XDG_CONFIG_HOME"
     35 #define SXHKD_SHELL_ENV     "SXHKD_SHELL"
     36 #define SHELL_ENV           "SHELL"
     37 #define CONFIG_PATH         "sxhkd/sxhkdrc"
     38 #define HOTKEY_PREFIX       'H'
     39 #define COMMAND_PREFIX      'C'
     40 #define BEGIN_CHAIN_PREFIX  'B'
     41 #define END_CHAIN_PREFIX    'E'
     42 #define TIMEOUT_PREFIX      'T'
     43 #define TIMEOUT              3
     44 
     45 extern xcb_connection_t *dpy;
     46 extern xcb_window_t root;
     47 extern xcb_key_symbols_t *symbols;
     48 
     49 extern char *shell;
     50 extern char config_file[MAXLEN];
     51 extern char *config_path;
     52 extern char **extra_confs;
     53 extern int num_extra_confs;
     54 extern int redir_fd;
     55 extern FILE *status_fifo;
     56 extern char progress[3 * MAXLEN];
     57 extern int mapping_count;
     58 extern int timeout;
     59 
     60 extern hotkey_t *hotkeys_head, *hotkeys_tail;
     61 extern bool running, grabbed, toggle_grab, reload, bell, chained, locked;
     62 extern xcb_keysym_t abort_keysym;
     63 extern chord_t *abort_chord;
     64 
     65 extern uint16_t num_lock;
     66 extern uint16_t caps_lock;
     67 extern uint16_t scroll_lock;
     68 
     69 void key_button_event(xcb_generic_event_t *evt, uint8_t event_type);
     70 void mapping_notify(xcb_generic_event_t *evt);
     71 void setup(void);
     72 void cleanup(void);
     73 void reload_cmd(void);
     74 void toggle_grab_cmd(void);
     75 void hold(int sig);
     76 void put_status(char c, const char *s);
     77 
     78 #endif