-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdisplay.lua
33 lines (28 loc) · 1.18 KB
/
display.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local display = {}
function display.setInternalBrightness(brightness)
local _brightness = brightness / 100
for _, display in pairs(hs.screen.allScreens()) do
if display:name() == "Built-in Retina Display" then
_log("Setting " .. display:name() .. " brightness to " .. brightness)
display:setBrightness(_brightness)
end
end
end
function display.setAllBrightness(brightness)
local _brightness = brightness / 100
for _, display in pairs(hs.screen.allScreens()) do
if display:name() == "Built-in Retina Display" then
_log("Setting " .. display:name() .. " brightness to " .. brightness)
display:setBrightness(_brightness)
else
_log("Setting " .. display:name() .. " brightness to " .. brightness)
-- Use ddcctl to set the brightness of all external displays
run.cmd(string.format("%s/bin/m1ddc", Homedir), {"set", "luminance", tostring(brightness)})
end
end
end
function display.init()
local initStart = os.clock()
_log(debug.getinfo(1, "S").short_src:gsub(".*/", "") .. " loaded in " .. (os.clock() - initStart) .. " seconds.")
end
return display