mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 10:48:35 +02:00
lib: add notifications for brightness change
This commit is contained in:
parent
c478921aea
commit
19f735065b
2 changed files with 35 additions and 0 deletions
32
lib/brightness.lua
Normal file
32
lib/brightness.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
-- Handle brightness (with xbacklight)
|
||||
|
||||
local awful = require("awful")
|
||||
local naughty = require("naughty")
|
||||
local tonumber = tonumber
|
||||
local string = string
|
||||
local os = os
|
||||
|
||||
module("vbe/brightness")
|
||||
|
||||
local nid = nil
|
||||
local function change(what)
|
||||
-- We don't really change the brightness, just report the change...
|
||||
local out = awful.util.pread("xbacklight -get")
|
||||
if not out then return end
|
||||
|
||||
out = tonumber(out)
|
||||
local icon = "/usr/share/icons/HighContrast/32x32/status/display-brightness.png"
|
||||
|
||||
nid = naughty.notify({ text = string.format("%3d %%", out),
|
||||
icon = icon,
|
||||
font = "Free Sans Bold 24",
|
||||
replaces_id = nid }).id
|
||||
end
|
||||
|
||||
function increase()
|
||||
change("+ 5")
|
||||
end
|
||||
|
||||
function decrease()
|
||||
change("- 5")
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue