From a8a8f1483e816b14fcd9b8019c9445a443465c37 Mon Sep 17 00:00:00 2001 From: Nokodoko Date: Tue, 12 Sep 2023 00:13:23 -0400 Subject: [PATCH] capslock script to let me know if I've activated caps lock --- caps.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 caps.lua diff --git a/caps.lua b/caps.lua new file mode 100755 index 0000000..ac9ea85 --- /dev/null +++ b/caps.lua @@ -0,0 +1,27 @@ +#!/bin/env lua + +local status_ok, h = pcall(require, "helpers") +if not status_ok then + return +end + +local t = {} + +local function xset() + local command = io.popen('xset q') + if not command then + Check(1, "Could not run xset command") + else + local output = command:read("*all") + local state = string.match(output, "Caps Lock:%s*(%a*)") + if state == "on" then + table.insert(t, state) + h.check(1, "Caps Lock is On!!") + return nil + else + os.exit(0, true) + end + end +end + +xset()