worked on some stuff and finally the new install script (no idea if it works yet)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
local aspawn = require('awful.spawn')
|
||||
local gobject = require('gears.object')
|
||||
local gtable = require('gears.table')
|
||||
local gtimer = require('gears.timer')
|
||||
|
||||
local backlight = {}
|
||||
|
||||
@@ -8,17 +9,25 @@ local instance = nil
|
||||
|
||||
function backlight.brightness_get_async(callback)
|
||||
aspawn.easy_async_with_shell('brightnessctl get', function(stdout)
|
||||
callback(tonumber(stdout:gsub('\n', '')))
|
||||
callback(stdout:gsub('\n', ''))
|
||||
end)
|
||||
end
|
||||
|
||||
function backlight:brightness_increase()
|
||||
aspawn('brightnessctl set 2+%')
|
||||
if not self.allow_cmd then return end
|
||||
self.allow_cmd = false
|
||||
aspawn.easy_async_with_shell('brightnessctl set 2+%', function()
|
||||
self.allow_cmd = true
|
||||
end)
|
||||
self:emit_signal('brightness_changed')
|
||||
end
|
||||
|
||||
function backlight:brightness_decrease()
|
||||
aspawn('brightnessctl set 2-%')
|
||||
if not self.allow_cmd then return end
|
||||
self.allow_cmd = false
|
||||
aspawn.easy_async_with_shell('brightnessctl set 2-%', function()
|
||||
self.allow_cmd = true
|
||||
end)
|
||||
self:emit_signal('brightness_changed')
|
||||
end
|
||||
|
||||
@@ -32,6 +41,11 @@ local function new()
|
||||
self.max_brightness = tonumber(stdout:gsub('\n', '') or 1)
|
||||
end)
|
||||
|
||||
-- Function locker to avoid spawning more commands than can be processed at a time
|
||||
self.allow_cmd = true
|
||||
|
||||
self:emit_signal('brightness_changed')
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user