From 457c2a2018c79da46266ec69469ae8200431941b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 31 Oct 2020 00:06:37 +0100 Subject: Add 'shiftdown' tool --- shiftdown/Makefile | 5 +++++ shiftdown/shiftdown | Bin 0 -> 19952 bytes shiftdown/shiftdown.c | 12 ++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 shiftdown/Makefile create mode 100644 shiftdown/shiftdown create mode 100644 shiftdown/shiftdown.c (limited to 'shiftdown') diff --git a/shiftdown/Makefile b/shiftdown/Makefile new file mode 100644 index 0000000..b5c2f21 --- /dev/null +++ b/shiftdown/Makefile @@ -0,0 +1,5 @@ +shiftdown: + gcc -o shiftdown shiftdown.c + +install: + install shiftdown /usr/bin/shiftdown diff --git a/shiftdown/shiftdown b/shiftdown/shiftdown new file mode 100644 index 0000000..fde6302 Binary files /dev/null and b/shiftdown/shiftdown differ diff --git a/shiftdown/shiftdown.c b/shiftdown/shiftdown.c new file mode 100644 index 0000000..bfd0a02 --- /dev/null +++ b/shiftdown/shiftdown.c @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +int main() { + char shift_state; + shift_state = 6; + if (ioctl(0, TIOCLINUX, &shift_state) == -1) + err(1, "could not get shift state"); + return !shift_state; +} -- cgit v1.2.3