-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
51 lines (41 loc) · 1.16 KB
/
init.lua
File metadata and controls
51 lines (41 loc) · 1.16 KB
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
49
50
51
--- Brightness Control for Awesome WM
-- Copyright (c) 2018 Joachim Nilsson <troglobit@gmail.com>
--
-- https://github.com/troglobit/awesome-light
--
-- standard libraries
local awful = require("awful")
-- variables
local light = {}
light.exec = "light" -- Full path if not in $PATH
light.kbd = "tpacpi::kbd_backlight" -- From /sys/class/leds/
light.kbd_step = 1
light.dpy = "" -- Autodetect
light.dpy_cap = 2
light.dpy_step = 10
-- functions
function light.dpy_inc()
awful.util.spawn(light.exec .. " -A " .. light.dpy_step)
end
function light.dpy_dec()
awful.util.spawn(light.exec .. " -U " .. light.dpy_step)
end
function light.kbd_toggle()
fp = io.popen(light.exec .. " -s " .. light.kbd .. " -k -r -G")
if fp then
if fp:read() == "0" then
val = light.kbd_step
else
val = 0
end
fp:close()
end
awful.util.spawn(light.exec .. " -s " .. light.kbd .. " -k -r -S " .. val)
end
function light.kbd_dim()
awful.util.spawn(light.exec .. " -s " .. light.kbd .. " -k -r -S 0")
end
function light.init()
awful.util.spawn(light.exec .. " -c -S " .. light.dpy_cap)
end
return light