Age | Commit message (Collapse) | Author |
|
After changing machines, I was having a problem with window layout
restoration. I had added this debug log, but then it magically started
working again. Committing this change anyway, maybe it actually did
something.
|
|
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.
|
|
Make the default table value of `window_positions` keys an empty table
(`{}`) to fix nil access errors on line 31:
window_positions[screen][window:id()] = window:frame()
|
|
Save all window positions when windows are moved, resized, created,
deleted.
When the primary monitor changes, restore previously saved window
positions for that monitor.
This ensures that our windows stay in the same position even after
connecting and disconnecting an external monitor.
|
|
|
|
Using an index of 2 didn't guarantee that the window accessed would be
window #2. Turns out the order of windows in the list is not consistent.
In order to target window #2, look for the "2. " prefix in the window
title.
|
|
When my external monitor is connected, ensure that iTerm's window #2 is
in the proper position. iTerm has a habit of getting its window layout
screwed up when switching monitors (or just not remembering window
layouts between monitors).
|