diff options
-rw-r--r-- | catalina_brightness_bullshit.lua | 10 | ||||
-rw-r--r-- | init.lua | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/catalina_brightness_bullshit.lua b/catalina_brightness_bullshit.lua index 1bc68c8..035a415 100644 --- a/catalina_brightness_bullshit.lua +++ b/catalina_brightness_bullshit.lua @@ -25,6 +25,12 @@ half_hour = 60 * 30 cbb_logger = hs.logger.new('catalina_brightness_bullshit', 'debug') +function cbb_brightness_restore() + hs.brightness.set(cbb_brightness) + + cbb_logger:d('restored brightness: ', cbb_brightness) +end + hs.timer.doEvery(half_hour, function() cbb_brightness = hs.brightness.get() @@ -41,9 +47,7 @@ cbb_wake_watcher = hs.caffeinate.watcher.new(function(event_type) if event_type == hs.caffeinate.watcher.screensDidUnlock or event_type == hs.caffeinate.watcher.screensDidWake then - hs.brightness.set(cbb_brightness) - - cbb_logger:d('restored brightness: ', cbb_brightness) + cbb_brightness_restore() end end) cbb_wake_watcher:start() @@ -32,4 +32,11 @@ spoon.WindowMode:bindHotkeys({ mode = {{'ctrl', 'option'}, 'w'} }) -- Shortcut to invert screen colours hs.hotkey.bind({}, 'f8', function() hs.eventtap.keyStroke({'cmd', 'option', 'ctrl'}, '8') + + -- Counteract a Catalina bug where sometimes inverting screen colours with + -- an external monitor connected makes the internal monitor's brightness + -- change to 100%. + if hs.screen.primaryScreen():name() ~= 'G247HL' then + cbb_brightness_restore() + end end) |