Add basic backlight brightness control without ui feedback
This commit is contained in:
parent
755eb1acc4
commit
422c078458
@ -107,6 +107,12 @@ config.keys.global_keys = {
|
|||||||
|
|
||||||
-- Previous track
|
-- Previous track
|
||||||
previousTrack = { {}, "XF86AudioPrev" },
|
previousTrack = { {}, "XF86AudioPrev" },
|
||||||
|
|
||||||
|
-- Brightness up
|
||||||
|
brightnessUp = { {}, "XF86MonBrightnessUp" },
|
||||||
|
|
||||||
|
-- Brightness down
|
||||||
|
brightnessDown = { {}, "XF86MonBrightnessDown" },
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Keyboard layout
|
-- Keyboard layout
|
||||||
|
@ -32,6 +32,23 @@ function sendToSpotify(command)
|
|||||||
awful.util.spawn_with_shell("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player." .. command)
|
awful.util.spawn_with_shell("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player." .. command)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Brightness control
|
||||||
|
function getBrightness()
|
||||||
|
local handle = io.popen("xbacklight -get")
|
||||||
|
local brightness = handle:read("*a")
|
||||||
|
handle:close()
|
||||||
|
return brightness
|
||||||
|
end
|
||||||
|
|
||||||
|
function increaseBrightness()
|
||||||
|
os.execute("xbacklight -inc 2")
|
||||||
|
end
|
||||||
|
|
||||||
|
function decreaseBrightness()
|
||||||
|
os.execute("xbacklight -dec 2")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Volume control
|
-- Volume control
|
||||||
function getVolume()
|
function getVolume()
|
||||||
if isMuted() then return 0 end
|
if isMuted() then return 0 end
|
||||||
@ -208,7 +225,13 @@ function getKeys(config)
|
|||||||
hotkey.make(config.nextTrack, nextTrack,
|
hotkey.make(config.nextTrack, nextTrack,
|
||||||
{ description = "Next track", group = "media control" }),
|
{ description = "Next track", group = "media control" }),
|
||||||
hotkey.make(config.previousTrack, previousTrack,
|
hotkey.make(config.previousTrack, previousTrack,
|
||||||
{ description = "Previous track", group = "media control" })
|
{ description = "Previous track", group = "media control" }),
|
||||||
|
|
||||||
|
-- Backlight control
|
||||||
|
hotkey.make(config.brightnessUp, increaseBrightness,
|
||||||
|
{ description = "Increase screen backlight brightness", group = "media control"}),
|
||||||
|
hotkey.make(config.brightnessDown, decreaseBrightness,
|
||||||
|
{ description = "Decrease screen backlight brightness", group = "media control"})
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user