clean 🫠
This commit is contained in:
parent
d3435e53a4
commit
d16174b447
9565 changed files with 0 additions and 1315422 deletions
|
@ -1,53 +0,0 @@
|
|||
-- ## Brightness ##
|
||||
-- ~~~~~~~~~~~~~~~~
|
||||
|
||||
-- requirements
|
||||
-- ~~~~~~~~~~~~
|
||||
local awful = require("awful")
|
||||
-- Provides:
|
||||
-- signal::brightness
|
||||
-- percentage (integer)
|
||||
|
||||
|
||||
-- Subscribe to backlight changes
|
||||
-- Requires inotify-tools
|
||||
local brightness_subscribe_script = [[
|
||||
bash -c "
|
||||
while (inotifywait -e modify /sys/class/backlight/?**/brightness -qq) do echo; done
|
||||
"]]
|
||||
|
||||
local brightness_script = [[
|
||||
sh -c "
|
||||
brightnessctl g
|
||||
"]]
|
||||
|
||||
local brightness_max = [[
|
||||
sh -c "
|
||||
brightnessctl m
|
||||
"]]
|
||||
|
||||
local emit_brightness_info = function()
|
||||
awful.spawn.with_line_callback(brightness_script, {
|
||||
stdout = function(value)
|
||||
awful.spawn.with_line_callback(brightness_max, {
|
||||
stdout = function(max)
|
||||
percentage = tonumber(value)/tonumber(max) * 100
|
||||
percentage = tonumber(percentage) or 0
|
||||
awesome.emit_signal("signal::brightness", percentage)
|
||||
end})
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
-- Run once to initialize widgets
|
||||
emit_brightness_info()
|
||||
|
||||
-- Kill old inotifywait process
|
||||
awful.spawn.easy_async_with_shell("ps x | grep \"inotifywait -e modify /sys/class/backlight\" | grep -v grep | awk '{print $1}' | xargs kill", function ()
|
||||
-- Update brightness status with each line printed
|
||||
awful.spawn.with_line_callback(brightness_subscribe_script, {
|
||||
stdout = function(_)
|
||||
emit_brightness_info()
|
||||
end
|
||||
})
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue