Removed useless backlight script

master
mark 2023-08-23 08:09:31 -07:00
parent 45c0c935a8
commit 6d836901aa
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 = {} 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(
script .. "get", "xbacklight -get",
function(stdout, stderr, exitreason, exitcode) function(stdout, stderr, exitreason, exitcode)
callback(tonumber(stdout)) callback(tonumber(stdout))
end end
@ -15,12 +10,12 @@ backlight.get = function(callback)
end end
backlight.set = function(value) backlight.set = function(value)
awful.spawn(script .. "set " .. value, false) awful.spawn("xbacklight -set " .. value, false)
end end
backlight.watch = function(timeout, callback, widget) backlight.watch = function(timeout, callback, widget)
awful.widget.watch( awful.widget.watch(
script .. "get", "xbacklight -get",
timeout, timeout,
callback, callback,
widget widget
@ -30,7 +25,7 @@ end
backlight.backlight_up = function(value) backlight.backlight_up = function(value)
awful.spawn.easy_async( awful.spawn.easy_async(
script .. "up " .. value, "xbacklight -inc " .. 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
@ -39,7 +34,7 @@ end
backlight.backlight_down = function(value) backlight.backlight_down = function(value)
awful.spawn.easy_async( awful.spawn.easy_async(
script .. "down " .. value, "xbacklight -dec " .. 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