-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtouchpadOn.lua
More file actions
executable file
·48 lines (40 loc) · 964 Bytes
/
Copy pathtouchpadOn.lua
File metadata and controls
executable file
·48 lines (40 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/env lua
local status_ok, h = pcall(require, "helpers")
if not status_ok then
return
end
local t = {}
local search = "Trackpad"
local command = 'xinput'
local function enabled(int)
local run = os.execute('xinput set-prop "'..int..'" "Device Enabled" 1 &')
if run then
h.check(0, "Touchpad Enabled")
else
h.check(1, "Touchpad still Enabled")
end
end
local function trackpad()
local handle = io.popen(command, 'r')
if handle then
for lines in handle:lines() do
if lines:match(search) then
table.insert(t, lines)
end
end
else
h.check(1, 'Could not find "'..search..'"')
end
return t
end
local function match(tbl)
local id_tab = {}
for _, v in ipairs(tbl) do
local id =string.match(v, "id=(%d)")
if id then
table.insert(id_tab, id)
end
end
return id_tab[1]
end
enabled(match(trackpad()))