Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed brightnessctl get command to get percentage value #400

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions brightness-widget/brightness.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ local function worker(user_args)
inc_brightness_cmd = 'xbacklight -inc ' .. step
dec_brightness_cmd = 'xbacklight -dec ' .. step
elseif program == 'brightnessctl' then
get_brightness_cmd = "brightnessctl get"
get_brightness_cmd = "sh -c 'brightnessctl -m | cut -d, -f4 | tr -d %'"
set_brightness_cmd = "brightnessctl set %d%%" -- <level>
inc_brightness_cmd = "brightnessctl set +" .. step .. "%"
dec_brightness_cmd = "brightnessctl set " .. step .. "-%"
Expand Down Expand Up @@ -130,7 +130,7 @@ local function worker(user_args)
function brightness_widget:set(value)
current_level = value
spawn.easy_async(string.format(set_brightness_cmd, value), function()
spawn.easy_async(get_brightness_cmd, function(out)
spawn.easy_async_with_shell(get_brightness_cmd, function(out)
update_widget(brightness_widget.widget, out)
end)
end)
Expand All @@ -157,14 +157,14 @@ local function worker(user_args)
end
function brightness_widget:inc()
spawn.easy_async(inc_brightness_cmd, function()
spawn.easy_async(get_brightness_cmd, function(out)
spawn.easy_async_with_shell(get_brightness_cmd, function(out)
update_widget(brightness_widget.widget, out)
end)
end)
end
function brightness_widget:dec()
spawn.easy_async(dec_brightness_cmd, function()
spawn.easy_async(get_brightness_cmd, function(out)
spawn.easy_async_with_shell(get_brightness_cmd, function(out)
update_widget(brightness_widget.widget, out)
end)
end)
Expand Down