mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
When waking macOS from sleep with multiple external monitors, it does not correctly display the wallpaper on all screens, and can sometimes get confused about window placement boundaries. The fix is to simply restart the Dock process which handles these things. This simply adds a cmd+ctrl+alt+k keybinding to trigger this via Hammerspoon. This is particularly useful in the rare occasion you wake a laptop without external displays which were disconnected when it was asleep, as it sometimes gets confused to the point it thinks there are external displays, and does not consider the internal display as part of the usable desktop space, meaning there's no way to open a terminal window to execute `killall Dock`. While this VERY rare, it does still happen, which more than justifies the few lines of lua here.
57 lines
1.9 KiB
Lua
57 lines
1.9 KiB
Lua
-- luacheck: read_globals hs spoon
|
|
|
|
-- Reload config hotkey
|
|
hs.hotkey.bind({ 'cmd', 'alt', 'ctrl' }, 'R', hs.reload)
|
|
hs.hotkey.bind({ 'cmd', 'alt', 'ctrl' }, 'C', hs.toggleConsole)
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- Set Hammerspoon options
|
|
--------------------------------------------------------------------------------
|
|
|
|
hs.autoLaunch(true)
|
|
hs.consoleOnTop(true)
|
|
hs.dockIcon(false)
|
|
hs.menuIcon(true)
|
|
hs.console.alpha(0.90)
|
|
hs.console.behaviorAsLabels { 'moveToActiveSpace' }
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- Load Spoons
|
|
--------------------------------------------------------------------------------
|
|
|
|
-- Draw pretty rounded corners on all screens.
|
|
hs.loadSpoon('RoundedCorners')
|
|
spoon.RoundedCorners.radius = 12
|
|
spoon.RoundedCorners:start()
|
|
|
|
-- Automatically pause music when headphones are unplugged.
|
|
hs.loadSpoon('HeadphoneAutoPause')
|
|
spoon.HeadphoneAutoPause.autoResume = false
|
|
spoon.HeadphoneAutoPause:start()
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- Host specific configuration
|
|
--------------------------------------------------------------------------------
|
|
|
|
local hostconfig = require('host_config')
|
|
hostconfig:init()
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- Window management
|
|
--------------------------------------------------------------------------------
|
|
|
|
local wm = require('window_management')
|
|
wm:init()
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- Misc. Helpers
|
|
--------------------------------------------------------------------------------
|
|
|
|
local kd = require('kill_dock')
|
|
hs.hotkey.bind({ 'cmd', 'alt', 'ctrl' }, 'K', kd.killDock)
|
|
|
|
--------------------------------------------------------------------------------
|
|
-- The End
|
|
--------------------------------------------------------------------------------
|
|
hs.alert.show('Hammerspoon loaded')
|