Add new notification-center module with various widgets, add rubato animations and other fixes and improvements
This commit is contained in:
@@ -17,10 +17,10 @@ BACKLIGHT_SEPS = 0
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-max-brightness",
|
||||
function(stdout)
|
||||
BACKLIGHT_MAX_BRIGHTNESS = tonumber(stdout)
|
||||
BACKLIGHT_SEPS = BACKLIGHT_MAX_BRIGHTNESS / 100
|
||||
BACKLIGHT_SEPS = math.floor(BACKLIGHT_SEPS)
|
||||
end
|
||||
BACKLIGHT_MAX_BRIGHTNESS = tonumber(stdout)
|
||||
BACKLIGHT_SEPS = BACKLIGHT_MAX_BRIGHTNESS / 100
|
||||
BACKLIGHT_SEPS = math.floor(BACKLIGHT_SEPS)
|
||||
end
|
||||
)
|
||||
|
||||
return function(s)
|
||||
@@ -112,60 +112,61 @@ return function(s)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:connect_signal(
|
||||
"property::value",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||
function(stdout)
|
||||
local brightness_value = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(tostring(brightness_value) .. "%")
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||
function(stdout)
|
||||
local brightness_value = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(tostring(brightness_value) .. "%")
|
||||
|
||||
awesome.emit_signal(
|
||||
"widget::brightness:update",
|
||||
brightness_value
|
||||
awesome.emit_signal(
|
||||
"widget::brightness:update",
|
||||
brightness_value
|
||||
)
|
||||
|
||||
if awful.screen.focused().show_brightness_osd then
|
||||
awesome.emit_signal(
|
||||
"module::brightness_osd:show",
|
||||
true
|
||||
)
|
||||
end
|
||||
|
||||
local icon = icondir .. "brightness"
|
||||
if brightness_value >= 0 and brightness_value < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif brightness_value >= 34 and brightness_value < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif brightness_value >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
|
||||
awesome.emit_signal("update::backlight_widget", brightness_value, icon .. ".svg")
|
||||
end
|
||||
)
|
||||
|
||||
if awful.screen.focused().show_brightness_osd then
|
||||
awesome.emit_signal(
|
||||
"module::brightness_osd:show",
|
||||
true
|
||||
)
|
||||
end
|
||||
|
||||
local icon = icondir .. "brightness"
|
||||
if brightness_value >= 0 and brightness_value < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif brightness_value >= 34 and brightness_value < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif brightness_value >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
|
||||
local update_slider = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ pkexec xfpm-power-backlight-helper --get-brightness ]],
|
||||
function(stdout)
|
||||
stdout = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(stdout)
|
||||
end
|
||||
stdout = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(stdout)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::brightness_slider:update",
|
||||
function()
|
||||
update_slider()
|
||||
end
|
||||
update_slider()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::brightness:update",
|
||||
function(value)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(value))
|
||||
end
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(value))
|
||||
end
|
||||
)
|
||||
|
||||
update_slider()
|
||||
@@ -199,36 +200,36 @@ return function(s)
|
||||
awesome.connect_signal(
|
||||
"widget::brightness_osd:rerun",
|
||||
function()
|
||||
if hide_brightness_osd.started then
|
||||
hide_brightness_osd:again()
|
||||
else
|
||||
hide_brightness_osd:start()
|
||||
if hide_brightness_osd.started then
|
||||
hide_brightness_osd:again()
|
||||
else
|
||||
hide_brightness_osd:start()
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::brightness_osd:show",
|
||||
function()
|
||||
if s == mouse.screen then
|
||||
brightness_container.visible = true
|
||||
if s == mouse.screen then
|
||||
brightness_container.visible = true
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
brightness_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:stop()
|
||||
end
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
brightness_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:again()
|
||||
end
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:again()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user