Compare commits
No commits in common. "90804f75bb9bc364f760293580f2e54c5de96e40" and "84cfee9afa4a2d260b75492b5307d68ffccfa74d" have entirely different histories.
90804f75bb
...
84cfee9afa
|
@ -0,0 +1,37 @@
|
||||||
|
#!/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
|
|
@ -1,8 +1,13 @@
|
||||||
local backlight = {}
|
local backlight = {}
|
||||||
|
|
||||||
|
-- The space at the end is important!
|
||||||
|
local script = conf_dir .. "modules/backlight/backlight.fish"
|
||||||
|
script = script .. " "
|
||||||
|
|
||||||
|
|
||||||
backlight.get = function(callback)
|
backlight.get = function(callback)
|
||||||
awful.spawn.easy_async(
|
awful.spawn.easy_async(
|
||||||
"xbacklight -get",
|
script .. "get",
|
||||||
function(stdout, stderr, exitreason, exitcode)
|
function(stdout, stderr, exitreason, exitcode)
|
||||||
callback(tonumber(stdout))
|
callback(tonumber(stdout))
|
||||||
end
|
end
|
||||||
|
@ -10,12 +15,12 @@ backlight.get = function(callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
backlight.set = function(value)
|
backlight.set = function(value)
|
||||||
awful.spawn("xbacklight -set " .. value, false)
|
awful.spawn(script .. "set " .. value, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
backlight.watch = function(timeout, callback, widget)
|
backlight.watch = function(timeout, callback, widget)
|
||||||
awful.widget.watch(
|
awful.widget.watch(
|
||||||
"xbacklight -get",
|
script .. "get",
|
||||||
timeout,
|
timeout,
|
||||||
callback,
|
callback,
|
||||||
widget
|
widget
|
||||||
|
@ -25,7 +30,7 @@ end
|
||||||
|
|
||||||
backlight.backlight_up = function(value)
|
backlight.backlight_up = function(value)
|
||||||
awful.spawn.easy_async(
|
awful.spawn.easy_async(
|
||||||
"xbacklight -inc " .. value,
|
script .. "up " .. value,
|
||||||
function(stdout, stderr, exitreason, exitcode)
|
function(stdout, stderr, exitreason, exitcode)
|
||||||
awesome.emit_signal("module::backlight:update_read")
|
awesome.emit_signal("module::backlight:update_read")
|
||||||
end
|
end
|
||||||
|
@ -34,7 +39,7 @@ end
|
||||||
|
|
||||||
backlight.backlight_down = function(value)
|
backlight.backlight_down = function(value)
|
||||||
awful.spawn.easy_async(
|
awful.spawn.easy_async(
|
||||||
"xbacklight -dec " .. value,
|
script .. "down " .. value,
|
||||||
function(stdout, stderr, exitreason, exitcode)
|
function(stdout, stderr, exitreason, exitcode)
|
||||||
awesome.emit_signal("module::backlight:update_read")
|
awesome.emit_signal("module::backlight:update_read")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue