mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 08:46:39 +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.
19 lines
314 B
Lua
19 lines
314 B
Lua
-- luacheck: read_globals hs
|
|
|
|
--- === kill_dock ===
|
|
---
|
|
--- Function to kill the Dock.
|
|
|
|
local obj = {}
|
|
|
|
--- kill_dock.killDock()
|
|
--- Function
|
|
--- Kills the Dock by executing `killall Dock`.
|
|
function obj.killDock()
|
|
hs.alert.show('Restarting Dock...')
|
|
hs.execute("killall Dock", true)
|
|
end
|
|
|
|
-- the end
|
|
return obj
|