-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
capslock script to let me know if I've activated caps lock
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |