reno/libs/syscontrol_test.lua

30 lines
1.3 KiB
Lua

-- This file is part of Reno desktop.
--
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
--
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
-- Who needs upower and xbacklight anyways?
local syscontrol = require("syscontrol")
local devices = syscontrol.power_supply.enumerate()
for k,v in pairs(devices) do
local data = syscontrol.power_supply.read_attribs(v)
print("Device: ")
for kk,vv in pairs(data) do
print(kk,vv)
end
end
local backlight_devices = syscontrol.backlight.enumerate()
for k,v in pairs(backlight_devices) do
local data = syscontrol.backlight.read_attribs(v)
print("Backlight device: ")
for kk,vv in pairs(data) do
print(kk,vv)
end
if data.writable then
syscontrol.backlight.set_brightness(data,data.max_brightness)
end
end