diff options
author | Teddy Wing | 2019-11-07 22:12:55 +0100 |
---|---|---|
committer | Teddy Wing | 2019-11-07 22:12:55 +0100 |
commit | fd6c28f6aa96392b5ef5edde9c31a1ec52329c6b (patch) | |
tree | 8571f06e57d8b1257eeccf5ea60251c43454a077 /window_layout.lua | |
parent | ab8d4c637552a1aa9db480fd4f7f60c8a47b80c3 (diff) | |
download | dothammerspoon-fd6c28f6aa96392b5ef5edde9c31a1ec52329c6b.tar.bz2 |
window_layout: Fix error when saved window not found
Saw this error when a saved window ID doesn't exist:
2019-11-07 16:25:03: 16:25:03 ERROR: LuaSkin: hs.screen.watcher
callback: $HOME/.hammerspoon/window_layout.lua:39: attempt to index
a nil value stack traceback:
$HOME/.hammerspoon/window_layout.lua:39: in upvalue 'window_positions_restore'
$HOME/.hammerspoon/window_layout.lua:52: in function </$HOME/.hammerspoon/window_layout.lua:51>
This could be when a saved window was closed, in which case we don't
care that its position can't be restored.
Diffstat (limited to 'window_layout.lua')
-rw-r--r-- | window_layout.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/window_layout.lua b/window_layout.lua index f8d201a..e32f37e 100644 --- a/window_layout.lua +++ b/window_layout.lua @@ -36,7 +36,11 @@ local function window_positions_restore() local screen = hs.screen.primaryScreen():id() for id, frame in pairs(window_positions[screen]) do - hs.window.get(id):setFrame(frame) + local window = hs.window.get(id) + + if window then + window:setFrame(frame) + end end end |