aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspv <spv@spv.sh>2025-12-05 14:13:15 -0500
committerspv <spv@spv.sh>2025-12-05 14:13:15 -0500
commita27e1fab1c383a1695bf116cfa5ac6fa08895edf (patch)
tree3925f1046fd926587c0ab557b8114f07ae1a632f
parentdf3775e6bfceac4ab6249c43cffaa348b0eee984 (diff)
add config.h opt for ignoring release events
-rw-r--r--src/config.h2
-rw-r--r--src/keypress_thread.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/config.h b/src/config.h
index b958706..7eeff32 100644
--- a/src/config.h
+++ b/src/config.h
@@ -19,4 +19,6 @@
/* cat `echo $BACKLIGHT_FILE | sed 's/brightness/max_brightness/g'` */
#define MAX_BRIGHTNESS 255
+#define IGNORE_RELEASE 1
+
#endif
diff --git a/src/keypress_thread.c b/src/keypress_thread.c
index 4afbd61..9aaed9a 100644
--- a/src/keypress_thread.c
+++ b/src/keypress_thread.c
@@ -25,9 +25,13 @@ void keypress_thread(pid_t _light_pid) {
fseek(fp, 0, SEEK_END);
fread(&pressed_key, 1, sizeof(pressed_key), fp);
- if (pressed_key.value == 1) {
+ #if IGNORE_RELEASE
+ if (pressed_key.value != 0) {
on_press();
}
+ #else
+ on_press();
+ #endif
usleep(DEBOUNCE);
}