aboutsummaryrefslogtreecommitdiff
path: root/hotkeythingy.c
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2020-06-17 16:24:49 +0530
committerAkshay Nair <phenax5@gmail.com>2020-06-17 16:30:21 +0530
commit31302d4def015c675a1806e3f6b91f00122afe10 (patch)
tree41331f27ad5030f54343b62d8074eebe045f35c5 /hotkeythingy.c
parentb178d1915d2578609be57a07ca32b36a26bac93b (diff)
downloadshotkey-31302d4def015c675a1806e3f6b91f00122afe10.tar.gz
shotkey-31302d4def015c675a1806e3f6b91f00122afe10.zip
cleanup
Diffstat (limited to 'hotkeythingy.c')
-rw-r--r--hotkeythingy.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hotkeythingy.c b/hotkeythingy.c
index f546231..93c21c2 100644
--- a/hotkeythingy.c
+++ b/hotkeythingy.c
@@ -46,9 +46,10 @@ void unbind_key(Display *dpy, Window win, unsigned int mod, KeySym key) {
}
int error_handler(Display *disp, XErrorEvent *xe) {
- if (xe->error_code == BadAccess) {
- printf("hotkeythingy: [BadAccess] Cant grab key binding. Already grabbed\n");
- return 0;
+ switch(xe->error_code) {
+ case BadAccess:
+ printf("hotkeythingy: [BadAccess] Cant grab key binding. Already grabbed\n");
+ return 0;
}
printf("hotkeythingy: Something went wrong\n");
@@ -67,6 +68,7 @@ void spawn(char** command) {
char* get_mode_label() {
if (current_mode == NormalMode) return "";
+ if (LENGTH(mode_properties) <= current_mode) return "";
ModeProperties props = mode_properties[current_mode];
return props.label;
}