From e058aa1c2b867e11ec56e09823ac6833d832c7db Mon Sep 17 00:00:00 2001 From: Julian Montez Date: Tue, 29 Sep 2026 18:58:59 -0400 Subject: [PATCH] Replace SizeUp with Rectangle Install Rectangle via the Brewfile, register it as a login item, and manage its shortcuts from RectangleConfig.json (Rectangle's own export format). Plist-type settings can now read a key from a nested dict via file:path, so the export is used as-is. Co-Authored-By: Claude Opus 5.5 --- Brewfile | 2 +- macos/README.md | 22 +++-- macos/RectangleConfig.json | 20 ++++ macos/SizeUp.plist | 197 ------------------------------------- macos/defaults.sh | 63 ++++++------ 5 files changed, 62 insertions(+), 242 deletions(-) create mode 100644 macos/RectangleConfig.json delete mode 100644 macos/SizeUp.plist diff --git a/Brewfile b/Brewfile index 007f6cc..e140816 100644 --- a/Brewfile +++ b/Brewfile @@ -52,7 +52,7 @@ cask "google-chrome" cask "docker-desktop" cask "1password" cask "1password-cli" # `op` -cask "sizeup" # keyboard-driven window manager +cask "rectangle" # keyboard-driven window manager cask "clipy" # clipboard manager with history cask "thaw" # menu bar manager — succeeded Ice cask "keyboardcleantool" # blocks input for keyboard cleaning diff --git a/macos/README.md b/macos/README.md index 70d8e78..2efa238 100644 --- a/macos/README.md +++ b/macos/README.md @@ -6,7 +6,7 @@ One-time system setup for fresh macOS installs. Not a stow package. ```bash bash macos/defaults.sh # apply bash macos/defaults.sh --check # report drift, write nothing, exit 1 if any -bash macos/defaults.sh --capture # re-copy SizeUp's live shortcuts into SizeUp.plist +bash macos/defaults.sh --capture # re-copy Rectangle's live shortcuts into RectangleConfig.json ``` Idempotent — safe to re-run. `bootstrap.sh` prompts to run it; `doctor.sh` calls @@ -26,7 +26,8 @@ apply writes. Booleans are normalised before comparison, since `defaults read` prints `0`/`1` rather than `false`/`true`. Nested values (dicts, arrays) use type `plist`: the row's value names a file in -`macos/` holding that key's value. Apply passes the XML straight to +`macos/` holding that key's value; `file:path` reads it from the dict at key +path `path` inside the file, which may be plist or JSON. Apply passes the XML straight to `defaults write`, which keeps every type; check compares the XML `plutil` renders from both sides. @@ -38,14 +39,15 @@ an explicit check branch. Read `SETTINGS` for the exact list. In summary: appearance, keyboard, text substitution, trackpad, Dock, Finder, screen saver, menu bar, and -per-app defaults for SizeUp and Clipy. Beyond the table: - -- **SizeUp** — every shortcut and window size, stored as `plist` rows backed by - [`SizeUp.plist`](SizeUp.plist). After changing SizeUp's preferences, run - `bash macos/defaults.sh --capture` and commit the diff. Capture copies only - the keys listed in `SETTINGS`, so usage counters, update timestamps, and window - positions in the same domain stay out of the repo; a new key needs its row - added first. Quit and relaunch SizeUp after an apply so it picks the values up. +per-app defaults for Rectangle and Clipy. Beyond the table: + +- **Rectangle** — every shortcut, stored as `plist` rows backed by the + `shortcuts` dict of [`RectangleConfig.json`](RectangleConfig.json), Rectangle's + own export format. After changing shortcuts, either export from Rectangle's + settings over that file or run `bash macos/defaults.sh --capture` (which + rewrites it as compact JSON), then commit the diff. A new shortcut needs its + row added first. Quit and relaunch Rectangle after an apply so it picks the + values up. It launches at login via `LOGIN_ITEM_APPS`. - **Dock contents** — populated via `dockutil` from `DOCK_APPS`. Entries whose app doesn't exist on this macOS version are skipped rather than aborting the run. - **Screen saver** — password required immediately. *Best-effort:* since Ventura this pane is partly system-managed and the write may not stick; `--check` shows it as drift if so. diff --git a/macos/RectangleConfig.json b/macos/RectangleConfig.json new file mode 100644 index 0000000..90b626d --- /dev/null +++ b/macos/RectangleConfig.json @@ -0,0 +1,20 @@ +{ + "bundleId" : "com.knollsoft.Rectangle", + "defaults" : {}, + "shortcuts" : { + "bottomHalf" : { "keyCode" : 125, "modifierFlags" : 1835008 }, + "bottomLeft" : { "keyCode" : 125, "modifierFlags" : 917504 }, + "bottomRight" : { "keyCode" : 124, "modifierFlags" : 917504 }, + "center" : { "keyCode" : 8, "modifierFlags" : 1835008 }, + "leftHalf" : { "keyCode" : 123, "modifierFlags" : 1835008 }, + "maximize" : { "keyCode" : 46, "modifierFlags" : 1835008 }, + "nextDisplay" : { "keyCode" : 124, "modifierFlags" : 786432 }, + "previousDisplay" : { "keyCode" : 123, "modifierFlags" : 786432 }, + "restore" : { "keyCode" : 44, "modifierFlags" : 1835008 }, + "rightHalf" : { "keyCode" : 124, "modifierFlags" : 1835008 }, + "topHalf" : { "keyCode" : 126, "modifierFlags" : 1835008 }, + "topLeft" : { "keyCode" : 123, "modifierFlags" : 917504 }, + "topRight" : { "keyCode" : 126, "modifierFlags" : 917504 } + }, + "version" : "1" +} diff --git a/macos/SizeUp.plist b/macos/SizeUp.plist deleted file mode 100644 index 9d91e05..0000000 --- a/macos/SizeUp.plist +++ /dev/null @@ -1,197 +0,0 @@ - - - - - Center - - ComboCode - 8 - ComboFlags - 1835008 - - Down - - ComboCode - 125 - ComboFlags - 1835008 - Height - 0.5 - Width - 1 - X - 0.0 - Y - 0.5 - - Full Screen - - ComboCode - 46 - ComboFlags - 1835008 - Height - 1 - Width - 1 - X - 0.0 - Y - 0.0 - - Left - - ComboCode - 123 - ComboFlags - 1835008 - Height - 1 - Width - 0.5 - X - 0.0 - Y - 0.0 - - Lower Left - - ComboCode - 125 - ComboFlags - 917504 - Height - 0.5 - Width - 0.5 - X - 0.0 - Y - 0.5 - - Lower Right - - ComboCode - 124 - ComboFlags - 917504 - Height - 0.5 - Width - 0.5 - X - 0.5 - Y - 0.5 - - Next Monitor - - ComboCode - 124 - ComboFlags - 786432 - - Prev Monitor - - ComboCode - 123 - ComboFlags - 786432 - - Right - - ComboCode - 124 - ComboFlags - 1835008 - Height - 1 - Width - 0.5 - X - 0.5 - Y - 0.0 - - SnapBack - - ComboCode - 44 - ComboFlags - 1835008 - - Space Above - - ComboCode - 126 - ComboFlags - 1310720 - - Space Below - - ComboCode - 125 - ComboFlags - 1310720 - - Space Next - - ComboCode - 124 - ComboFlags - 1310720 - - Space Prev - - ComboCode - 123 - ComboFlags - 1310720 - - Up - - ComboCode - 126 - ComboFlags - 1835008 - Height - 0.5 - Width - 1 - X - 0.0 - Y - 0.0 - - Upper Left - - ComboCode - 123 - ComboFlags - 917504 - Height - 0.5 - Width - 0.5 - X - 0.0 - Y - 0.0 - - Upper Right - - ComboCode - 126 - ComboFlags - 917504 - Height - 0.5 - Width - 0.5 - X - 0.5 - Y - 0.0 - - - diff --git a/macos/defaults.sh b/macos/defaults.sh index f49ebd9..6368eba 100755 --- a/macos/defaults.sh +++ b/macos/defaults.sh @@ -4,7 +4,7 @@ # bash macos/defaults.sh apply everything # bash macos/defaults.sh --check report drift, write nothing, exit 1 if any # bash macos/defaults.sh --capture copy live values of plist-type settings -# (SizeUp's shortcuts) into their data files +# (Rectangle's shortcuts) into their data files # # Settings live in one SETTINGS table consumed by every mode, so a check can # never fall out of sync with what apply writes. @@ -42,9 +42,10 @@ note_ok() { [[ "$MODE" == check ]] && echo " ✓ $*"; return 0; } # domain -g is the global domain in -currentHost scope; NSGlobalDomain elsewhere # type bool | int | string # plist → value names a file in macos/ holding 's value, for -# nested dicts/arrays (user scope only). The rows double as -# the allowlist --capture copies, so volatile or private keys -# in the same domain never reach the repo. +# nested dicts/arrays (user scope only); file:path reads +# from the dict at key path inside the file. The +# rows double as the allowlist --capture copies, so volatile or +# private keys in the same domain never reach the repo. # --------------------------------------------------------------------------- SETTINGS=( # ---- Appearance ---- @@ -107,29 +108,21 @@ SETTINGS=( "user|com.apple.controlcenter|NSStatusItem VisibleCC NowPlaying|bool|true" # ---- Third-party apps ---- - "user|com.irradiatedsoftware.SizeUp|MenuEnabled|bool|false" - "user|com.irradiatedsoftware.SizeUp|suppressMenuBarDisabledPopup|bool|true" - "user|com.irradiatedsoftware.SizeUp|CenterResizeEnabled|bool|false" - "user|com.irradiatedsoftware.SizeUp|ShortcutsDisabled|bool|false" - # One row per SizeUp action: its shortcut (ComboCode/ComboFlags) and, for - # sizing actions, the window rect as screen fractions (X/Y/Width/Height). - "user|com.irradiatedsoftware.SizeUp|Center|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Down|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Full Screen|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Left|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Lower Left|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Lower Right|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Next Monitor|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Prev Monitor|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Right|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|SnapBack|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Space Above|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Space Below|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Space Next|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Space Prev|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Up|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Upper Left|plist|SizeUp.plist" - "user|com.irradiatedsoftware.SizeUp|Upper Right|plist|SizeUp.plist" + # One row per Rectangle action's shortcut, read from the "shortcuts" dict of + # Rectangle's own export format. + "user|com.knollsoft.Rectangle|bottomHalf|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|bottomLeft|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|bottomRight|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|center|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|leftHalf|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|maximize|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|nextDisplay|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|previousDisplay|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|restore|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|rightHalf|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|topHalf|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|topLeft|plist|RectangleConfig.json:shortcuts" + "user|com.knollsoft.Rectangle|topRight|plist|RectangleConfig.json:shortcuts" "user|com.clipy-app.Clipy|kCPYPrefShowStatusItemKey|bool|false" ) @@ -148,7 +141,7 @@ DOCK_APPS=( # Apps to register as login items. LOGIN_ITEM_APPS=( - "/Applications/SizeUp.app" + "/Applications/Rectangle.app" "/Applications/Mullvad VPN.app" "/Applications/Amphetamine.app" "/Applications/Thaw.app" @@ -193,12 +186,14 @@ write_default() { fi } -# process_plist_setting — a nested value stored under -# in . `defaults write` accepts the XML document as-is and keeps -# every type; check compares both sides as plutil-rendered XML. +# process_plist_setting [:] — a nested value stored +# under (or .) in , which may be plist or JSON. +# `defaults write` accepts the XML document as-is and keeps every type; check +# compares both sides as plutil-rendered XML. process_plist_setting() { - local domain="$1" key="$2" file="$3" actual want - want="$(plutil -extract "$key" xml1 -o - "$file")" + local domain="$1" key="$2" file="${3%%:*}" actual want src="$2" + [[ "$3" == *:* ]] && src="${3#*:}.$key" + want="$(plutil -extract "$src" xml1 -o - "$file")" if [[ "$MODE" == apply ]]; then defaults write "$domain" "$key" "$want" @@ -212,7 +207,7 @@ process_plist_setting() { echo " ! $domain $key is unset — ${file##*/} left unchanged" >&2 return 0 fi - plutil -replace "$key" -xml "$actual" "$file" + plutil -replace "$src" -xml "$actual" "$file" echo " ✓ captured $domain $key" return 0 fi