64 lines
1.2 KiB
Lua
Executable File
64 lines
1.2 KiB
Lua
Executable File
local backlight = {}
|
|
|
|
-- The space at the end is important!
|
|
local script = conf_dir .. "modules/backlight/backlight.fish"
|
|
script = script .. " "
|
|
|
|
|
|
backlight.get = function(callback)
|
|
awful.spawn.easy_async(
|
|
script .. "get",
|
|
function(stdout, stderr, exitreason, exitcode)
|
|
callback(tonumber(stdout))
|
|
end
|
|
)
|
|
end
|
|
|
|
backlight.set = function(value)
|
|
awful.spawn(script .. "set " .. value, false)
|
|
end
|
|
|
|
backlight.watch = function(timeout, callback, widget)
|
|
awful.widget.watch(
|
|
script .. "get",
|
|
timeout,
|
|
callback,
|
|
widget
|
|
)
|
|
end
|
|
|
|
|
|
backlight.backlight_up = function(value)
|
|
awful.spawn.easy_async(
|
|
script .. "up " .. value,
|
|
function(stdout, stderr, exitreason, exitcode)
|
|
awesome.emit_signal("module::backlight:update_read")
|
|
end
|
|
)
|
|
end
|
|
|
|
backlight.backlight_down = function(value)
|
|
awful.spawn.easy_async(
|
|
script .. "down " .. value,
|
|
function(stdout, stderr, exitreason, exitcode)
|
|
awesome.emit_signal("module::backlight:update_read")
|
|
end
|
|
)
|
|
end
|
|
|
|
awesome.connect_signal("module::backlight:update_read",
|
|
function()
|
|
backlight.get(
|
|
function(value)
|
|
awesome.emit_signal(
|
|
"module::backlight:update",
|
|
value
|
|
)
|
|
end
|
|
)
|
|
end
|
|
)
|
|
|
|
|
|
return backlight
|