Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 84 lines (74 sloc) 2.793 kb
65c3352 @baskerville Use generic BSD 2-clause license
authored
1 /* Copyright (c) 2013, Bastien Dejean
cb7b2e8 @baskerville Add license headers
authored
2 * All rights reserved.
3 *
615fdd0 @baskerville Update license
authored
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
cb7b2e8 @baskerville Add license headers
authored
6 *
615fdd0 @baskerville Update license
authored
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.
cb7b2e8 @baskerville Add license headers
authored
12 *
615fdd0 @baskerville Update license
authored
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
cb7b2e8 @baskerville Add license headers
authored
17 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
615fdd0 @baskerville Update license
authored
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
cb7b2e8 @baskerville Add license headers
authored
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
68ac4aa @baskerville Decrease the header guards collision chances
authored
25 #ifndef SXHKD_SXHKD_H
26 #define SXHKD_SXHKD_H
e019134 @baskerville First commit
authored
27
28 #include <xcb/xcb_keysyms.h>
29 #include <stdio.h>
30 #include <stdbool.h>
0759508 @baskerville Relay motion events as messages on a socket
authored
31 #include <sys/un.h>
383a202 @baskerville Reorganize code
authored
32 #include "types.h"
e019134 @baskerville First commit
authored
33 #include "helpers.h"
34
980c53e @baskerville Support optional extra configurations
authored
35 #define CONFIG_HOME_ENV "XDG_CONFIG_HOME"
807917d @baskerville Support alternative shell definition
authored
36 #define SXHKD_SHELL_ENV "SXHKD_SHELL"
37 #define SHELL_ENV "SHELL"
980c53e @baskerville Support optional extra configurations
authored
38 #define CONFIG_PATH "sxhkd/sxhkdrc"
0759508 @baskerville Relay motion events as messages on a socket
authored
39 #define SOCKET_ENV "BSPWM_SOCKET"
40 #define SOCKET_PATH_TPL "/tmp/bspwm%s_%i_%i-socket"
41 #define MOTION_MSG_TPL "pointer -t X Y"
3025a88 @baskerville New option: `-s`
authored
42 #define HOTKEY_PREFIX 'H'
43 #define COMMAND_PREFIX 'C'
44 #define TIMEOUT_PREFIX 'T'
8e57c53 @baskerville Implement chord chains
authored
45 #define TIMEOUT 3
e019134 @baskerville First commit
authored
46
47 xcb_connection_t *dpy;
48 xcb_window_t root;
49 xcb_key_symbols_t *symbols;
980c53e @baskerville Support optional extra configurations
authored
50
0847f5b @baskerville Keep order of configuration in hotkeys
authored
51 char *shell;
980c53e @baskerville Support optional extra configurations
authored
52 char config_file[MAXLEN];
53 char *config_path;
54 char **extra_confs;
55 int num_extra_confs;
6dd6a8b @baskerville Add an option to redirect the commands output
authored
56 int redir_fd;
3025a88 @baskerville New option: `-s`
authored
57 FILE *status_fifo;
0759508 @baskerville Relay motion events as messages on a socket
authored
58 struct sockaddr_un sock_address;
59 char motion_msg_tpl[MAXLEN];
0996be8 @baskerville Increase maximum line length
authored
60 char progress[3 * MAXLEN];
49918e7 @baskerville Ignore mapping notify events by default
authored
61 int mapping_count;
8e57c53 @baskerville Implement chord chains
authored
62 int timeout;
3097d06 @baskerville Add an option to specify the motion events maximum frequency
authored
63 double motion_interval;
64 xcb_timestamp_t last_motion_time;
980c53e @baskerville Support optional extra configurations
authored
65
6f195e7 @baskerville Implement command cycles
authored
66 hotkey_t *hotkeys_head, *hotkeys_tail;
a4c9908 @baskerville Handle modes via the colon separator
authored
67 bool running, reload, bell, chained, locked;
68 chord_t *escape_chord;
e019134 @baskerville First commit
authored
69
70 uint16_t num_lock;
71 uint16_t caps_lock;
72 uint16_t scroll_lock;
73
2cf4e93 @baskerville Generate header function prototypes from .c
authored
74 void key_button_event(xcb_generic_event_t *evt, uint8_t event_type);
0759508 @baskerville Relay motion events as messages on a socket
authored
75 void motion_notify(xcb_generic_event_t *evt);
2cf4e93 @baskerville Generate header function prototypes from .c
authored
76 void mapping_notify(xcb_generic_event_t *evt);
e019134 @baskerville First commit
authored
77 void setup(void);
78 void cleanup(void);
56deda4 @baskerville Minor cleanups
authored
79 void reload_cmd(void);
2cf4e93 @baskerville Generate header function prototypes from .c
authored
80 void hold(int sig);
4560672 @baskerville Improve const-correctness
authored
81 void put_status(char c, const char *s);
e019134 @baskerville First commit
authored
82
83 #endif
Something went wrong with that request. Please try again.