aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin <calvin@bastille>2014-02-23 15:41:35 -0500
committerCalvin <calvin@bastille>2014-02-23 15:41:35 -0500
commitdc0222175d99a7b156c6047e6988e8805bb2e14d (patch)
treebcb6ac30cd2f732dd22832f203eecbc437a23fc1
parentd500577952549c68ac778e7cc58328c616ee99f9 (diff)
update readme and fix warning
-rw-r--r--README.md4
-rwxr-xr-xdynamic_keybind.sh7
-rw-r--r--hotkey.c8
3 files changed, 13 insertions, 6 deletions
diff --git a/README.md b/README.md
index be5ea25..7a36b63 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,8 @@ easy to install.
# adding hotkeys
-easy to modify. Just open up keys.h and edit it. If you want your job not to
-hang hotkey, make sure to add & to the end of your commands.
+Easy to modify. Just open up ~/.hotkeysrc and edit it. Look at example_rc
+for an example of how to use it.
# License
diff --git a/dynamic_keybind.sh b/dynamic_keybind.sh
new file mode 100755
index 0000000..242c3bc
--- /dev/null
+++ b/dynamic_keybind.sh
@@ -0,0 +1,7 @@
+if [ ! -f $HOME/.hotkeyrc ]; then
+ echo "no ~/.hotkeyrc found"
+ exit;
+fi;
+v=0
+`while read $i; do echo $v" "$i; v=$(($v+1));done < $HOME/.hotkeyrc | dmenu -l 5 | sed 's/^[0-9] //g'`
+
diff --git a/hotkey.c b/hotkey.c
index 16844af..4deda6b 100644
--- a/hotkey.c
+++ b/hotkey.c
@@ -127,13 +127,13 @@ struct Key **load_hotkeys(FILE *fh, size_t *key_len) {
keys[*key_len] = key;
*key_len = *key_len + 1;
- realloc(keys, sizeof(struct Key *) * realloc_size);
- realloc_size++;
-
+ keys = realloc(keys, sizeof(struct Key *) * realloc_size);
if(keys == NULL) {
fprintf(stderr, "could not realloc keys\n");
exit(EXIT_FAILURE);
}
+
+ realloc_size++;
}
line_nb++;
@@ -141,6 +141,7 @@ struct Key **load_hotkeys(FILE *fh, size_t *key_len) {
if(*key_len != 0)
return keys;
+
return NULL;
}
@@ -165,7 +166,6 @@ void wait_for_input(Display* dpy, Window root, struct Key **hotkeys, size_t len)
}
}
}
-
}
int main(int argc, char **argv) {