Skip to content

Commit

Permalink
capslock script to let me know if I've activated caps lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Nokodoko committed Sep 12, 2023
1 parent 872f381 commit a8a8f14
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions caps.lua
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit a8a8f14

Please sign in to comment.