aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2020-06-17 10:30:02 +0530
committerAkshay Nair <phenax5@gmail.com>2020-06-17 10:30:02 +0530
commitd2e74bf6b19f5669ff22b0c7cb6600e78de2cf03 (patch)
tree38ccba9c84aa54cce71409f8cc3f87dc6031321d
parentc8549d08725f654870f25a2c837ab7fdb470c7f6 (diff)
downloadshotkey-d2e74bf6b19f5669ff22b0c7cb6600e78de2cf03.tar.gz
shotkey-d2e74bf6b19f5669ff22b0c7cb6600e78de2cf03.zip
Fixes mode keys binding
-rw-r--r--TODO.md2
-rw-r--r--config.h8
-rw-r--r--daemonic.c2
3 files changed, 10 insertions, 2 deletions
diff --git a/TODO.md b/TODO.md
index d651aa9..dd0a0a6 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,8 +1,10 @@
# TODO
- [ ] Some magic helpers for clean config
- [X] Add modes
+ - [ ] Persistent mode
- [ ] Abstract normal mode as just another mode
- [ ] Get current mode from cli
+ - [ ] Hook for mode change
- [ ] KeyPress and KeyRelease options
- [ ] Document stuff
- [ ] Clean up build system
diff --git a/config.h b/config.h
index cb06104..396b62c 100644
--- a/config.h
+++ b/config.h
@@ -5,6 +5,7 @@ static char shell[] = "sh";
enum {
Music,
+ Bright,
// Declare modes above this
MODE_SIZE, // NOTE: Do not remove this
@@ -14,7 +15,11 @@ enum {
// NOTE: "10" here is the maximum number of key bindings for each mode
static Key modes[MODE_SIZE][10] = {
[Music] = {
- { MOD|ShiftMask, XK_m, cmd("notify-send inside") },
+ { 0, XK_m, cmd("notify-send inside_music") },
+ },
+ [Bright] = {
+ { 0, XK_m, cmd("notify-send inside_bright") },
+ { 0, XK_n, cmd("notify-send inside_bright_1") },
},
};
@@ -22,5 +27,6 @@ static Key modes[MODE_SIZE][10] = {
static Key keys[] = {
{ MOD|ShiftMask, XK_y, cmd("notify-send hello") },
{ MOD|ShiftMask, XK_z, mode(Music) },
+ { MOD|ShiftMask, XK_x, mode(Bright) },
};
diff --git a/daemonic.c b/daemonic.c
index d2c90cb..bb22d47 100644
--- a/daemonic.c
+++ b/daemonic.c
@@ -67,7 +67,7 @@ void run(Display* dpy, Window win, Command command) {
if (modes[current_mode] && current_mode < MODE_SIZE) {
for (i = 0; i < LENGTH(modes[current_mode]); i++) {
mode_key = modes[current_mode][i];
- bind_key(dpy, win, keys[i].mod, keys[i].key);
+ bind_key(dpy, win, mode_key.mod, mode_key.key);
}
}