Compare commits

..

2 Commits

2 changed files with 5 additions and 47 deletions

View File

@ -1,37 +0,0 @@
#!/usr/bin/fish
#
# Usage:
# backlight get
# backlight set [value]
# backlight max
#
# Returns:
# Set - nothing
# Get, max - Number between 0 and 100 (eg: 0, 25.445283, 100)
#
function backlight
switch $argv[1]
case "get"
xbacklight -get
case "max"
echo 100
case "set"
xbacklight -set $argv[2]
case "up"
xbacklight -inc $argv[2]
case "down"
xbacklight -dec $argv[2]
case "*"
echo "Unknown function \"$argv[1]\""
echo ""
echo "Usage:"
echo " backlight get"
echo " backlight set [value]"
echo " backlight max"
return 0
end
return 1
end
backlight $argv

View File

@ -1,13 +1,8 @@
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",
"xbacklight -get",
function(stdout, stderr, exitreason, exitcode)
callback(tonumber(stdout))
end
@ -15,12 +10,12 @@ backlight.get = function(callback)
end
backlight.set = function(value)
awful.spawn(script .. "set " .. value, false)
awful.spawn("xbacklight -set " .. value, false)
end
backlight.watch = function(timeout, callback, widget)
awful.widget.watch(
script .. "get",
"xbacklight -get",
timeout,
callback,
widget
@ -30,7 +25,7 @@ end
backlight.backlight_up = function(value)
awful.spawn.easy_async(
script .. "up " .. value,
"xbacklight -inc " .. value,
function(stdout, stderr, exitreason, exitcode)
awesome.emit_signal("module::backlight:update_read")
end
@ -39,7 +34,7 @@ end
backlight.backlight_down = function(value)
awful.spawn.easy_async(
script .. "down " .. value,
"xbacklight -dec " .. value,
function(stdout, stderr, exitreason, exitcode)
awesome.emit_signal("module::backlight:update_read")
end