Rewrote backlight manager

This commit is contained in:
2022-04-24 09:10:12 -07:00
parent 0d09d5315f
commit 50ac1bcfcb
11 changed files with 251 additions and 171 deletions

View File

@ -1,6 +1,3 @@
dir = configuration_dir .. "bin/"
local script_dir = dir .. "scripts/"
return {
system = {
@ -18,26 +15,6 @@ return {
},
backlight = {
watch = function(timeout, callback, widget)
awful.widget.watch(script_dir .. "backlight get", timeout, callback, widget)
end,
get = function(callback)
awful.spawn.easy_async(script_dir .. "backlight get", callback)
end,
set = function(value)
awful.spawn(script_dir .. "backlight set " .. value, false)
end,
up = function()
awful.spawn(script_dir .. "backlight up", false)
end,
down = function()
awful.spawn(script_dir .. "backlight down", false)
end,
redshift = function(temp)
awful.spawn("redshift -O " .. tostring(temp), false)
end,
@ -59,7 +36,7 @@ return {
rofi = {
launcher = function()
awful.spawn("rofi -show drun -theme \"" .. dir .. "/rofi/launcher.rasi\"")
awful.spawn("rofi -show drun -theme \"" .. bin_dir .. "/rofi/launcher.rasi\"")
end
},

View File

@ -4,6 +4,7 @@
# backlight get
# backlight set [value]
# backlight max
# backlight [up|down] [delta]
#
# Returns:
# Set - nothing
@ -19,9 +20,9 @@ function backlight
case "set"
xbacklight -set $argv[2]
case "up"
xbacklight -inc 10
xbacklight -inc $argv[2]
case "down"
xbacklight -dec 10
xbacklight -dec $argv[2]
case "*"
echo "Unknown function \"$argv[1]\""
echo ""