Skip to content
amiralibgPublic

About

A tiling window manager for macOS.

Resources

Stars

29 stars

Watchers

0 watching

Forks

Latest commit

 

History

181 Commits

Folders and files

Repository files navigation

Weft

Weft

A tiling window manager for macOS.
Fast, light, native tiling — with your keyboard shortcuts built in.

platform: macOS 15+ swift 6.2 license: MIT


What it is

Weft arranges your windows for you and runs your keyboard shortcuts, in one small native app. A shortcut is handled inside weft the instant you press it — nothing is launched per keypress — so focusing, moving, resizing and switching windows happens with no wait, and weft stays out of the way the rest of the time.

Each of your macOS desktops is a workspace: weft tiles every one, switches between them instantly from the keyboard, and sends any window to any desktop — with Mission Control, the trackpad swipe and full-screen apps working as macOS ships them, and System Integrity Protection left exactly as it is.

  • Two layouts per space — bsp (binary split) and float (no tiling at all). Switch a space between them at runtime; window membership and focus survive the change.
  • Moving restructures, it does not swap — move east takes the window one step east in the layout tree, so it keeps its size. Swapping it with whatever window is over there, which is what most BSP tilers do by default, means a half-screen window can come back as a quarter. swap <dir> is there for when you do want the literal trade.
  • Stacks — collapse several windows into one slot and cycle through them. The windows behind show as a row of title bars you can click to bring one forward. stack all puts the whole space in one stack; stack move <dir> drops the focused window into its neighbour's.
  • Modes — modal layers, like vim's. The shipped config puts resizing behind one so h/j/k/l can be bare keys while it is active.
  • Runs your commands too — exec <anything> goes through /bin/sh, so the half of an skhd config that was never about windows keeps working. The command gets WEFT_SPACE_LABEL, WEFT_FOCUSED_APP and the rest of weft's state in its environment, so a script never has to ask.
  • Window rules — regex on app name or window title; send an app to a space, or tell weft to leave it alone entirely.
  • Multi-display — spaces are tiled in their own display's rect, and west/east pick the display geometrically rather than by arrangement index.
  • Mouse — drag the border between two tiled windows to resize them, with no modifier and no mode; hold a modifier to drag a window by its body. Weft claims a plain click only when it lands on a border, so every other click reaches the app untouched.
  • Knows a popup when it sees one — a dialog, a window the app refuses to resize, or a small frameless panel with no title-bar buttons is floated rather than given a slot. That is what an Electron app's floating call widget is, and tiling one hands a quarter of the screen to a badge.
  • Works around a window's minimum size — a window that will not go as small as its tile (T3 Code and other Electron apps stop at a few hundred points) gets the room it needs from its neighbours, instead of hanging off the screen. Weft learns the floor from the window itself; your split ratios are untouched, so the room goes back when the window does.
  • A menu-bar app with a visual settings editor, a searchable keybinding cheatsheet (⌘K), and a window switcher (⌃⌥Space). Quit Weft stops tiling and keybinds along with the icon; opening WeftBar starts them again. Hold ⌥ for Quit Menu Bar Only, which leaves weft tiling.

Weft is young, and it asks for real system permissions to do its job. The design notes in docs/DESIGN.md are candid about what is solved, what is a heuristic, and what macOS simply will not allow — read them before trusting it with your desktop.

Install

macOS 15 or later, Intel or Apple Silicon.

curl -fsSL --retry 5 --retry-all-errors \
  https://raw.githubusercontent.com/amiralibg/weft/main/scripts/install-release.sh | bash

That downloads the latest release, verifies its checksum, installs weftd and weftctl into ~/.local/bin and WeftBar.app into ~/Applications, seeds a config, registers the launchd service, and opens Setup. No toolchain, no compile.

Without a terminal: download WeftBar-<version>.zip from the releases page, open it, and drag WeftBar into Applications. The first time you open it macOS will say it cannot check the app — it is not notarised — so go to System Settings › Privacy & Security and click Open Anyway. WeftBar then installs the engine itself (into ~/.local/bin, signed so your permissions survive updates), writes a starting config, and walks you through the permissions. Updating is the same: use Update to weft … in its menu, or replace the app.

Prefer to look before you run it? Download the archive from the releases page, check it, and run the install.sh inside:

shasum -a 256 -c weft-*-macos-universal.tar.gz.sha256
tar -xzf weft-*-macos-universal.tar.gz && cd weft-*/
./install.sh
Build from source instead

Needs a Swift 6.2+ toolchain (swift --version).

git clone https://github.com/amiralibg/weft.git
cd weft
./scripts/install.sh

Either way, if ~/.local/bin is not on your PATH:

export PATH="$HOME/.local/bin:$PATH"

About the released binaries

They are ad-hoc signed, not notarised — weft has no paid Apple Developer account behind it. Two consequences worth knowing up front:

  • macOS quarantines anything downloaded from the internet, and refuses to launch an unsigned app that carries the flag — reporting it as "damaged", which it is not. The installer clears the flag from the files it installs. That is the one thing in it you should read before piping it to a shell.
  • macOS identifies an unsigned binary by its contents, so every new build would be a different program as far as Privacy & Security is concerned — and an update would drop weftd's grants while leaving the switches in System Settings visibly on, granting nothing. install.sh avoids this by creating one self-signed code-signing identity on first run (kept in its own keychain, no password prompt) and signing every binary with it. The permission is then tied to that identity rather than to the bytes, so grants survive every future rebuild and update. Deleting ~/Library/Keychains/weft-signing.keychain-db starts a new identity and costs one re-grant.

Neither applies to a build signed with a Developer ID — the release workflow does that automatically if the repository has the signing secrets configured.

Updates

weft installs from a script or a clone, so nothing would otherwise tell you a fix exists. WeftBar asks GitHub once a day whether a newer release is out and adds a menu-bar item when there is one. Settings › Advanced › Updates shows the same thing with a Check Now button, and opening it asks for you if the answer on disk has aged out.

Clicking Update asks first, then runs the release's own install-release.sh — the same script the one-liner runs, not a second updater. It downloads the release, verifies the checksum, replaces the copy of WeftBar you are running, restarts the service and reopens the app. Your settings and permissions carry over, because the installer signs weft with a stable identity.

Most of an update is the download, and on a slow link to GitHub that is minutes rather than seconds, so Settings shows a progress bar, the percentage and an elapsed clock throughout. WeftBar quits partway through by design — that is the installer replacing it — and reopens on its own.

Turn the check off with check-for-updates = false under [general]. Updating by hand is always the one-liner at the top of this file.

Workspaces

A workspace is one of your macOS desktops, with a layout of its own — what ⌥1…⌥9 and your [[space]] blocks refer to. Desktops are numbered the way Mission Control shows them: the main display's first, left to right, then each other display west to east. Full-screen apps' spaces have no number.

  • Switching is instant. space focus 3 shows desktop 3 in one step, at any distance, with no animation. A desktop already showing on another display just takes focus; nothing else changes. next, prev and recent work too.
  • Sending a window is instant. space move-window 3 sends the focused window to desktop 3 — any window, including a terminal with its title bar hidden, and to a desktop on another display — and you stay where you are. --follow goes with it. A rule's space = "…" places a new window the same way as it opens (follow-space-rules = false keeps you where you are).
  • macOS's own desktop tools keep working. Mission Control, the swipe, ⌃←/⌃→ and native full screen behave exactly as macOS intends; weft notices whichever way you switch, holds still while Mission Control is open, and tiles what you drag between desktops there.
  • Add desktops in Mission Control. weft cannot create or delete desktops; it follows however many you have. A label or number with no desktop says so. Turn off Automatically rearrange Spaces based on most recent use (Desktop & Dock › Mission Control) so the numbers stay put; weftctl doctor warns when it is on.
  • All desktops. For an app's windows on every desktop, right-click its Dock icon › Options › All Desktops. weft floats those windows and never moves them.
  • Every desktop is tiled, the hidden ones too: a window moved to a desktop is in its tile before you get there.
  • Layouts survive restarts, log outs and unplugging a display.

The design, and what it measured, is in docs/NATIVE.md.

Permissions

Weft needs three macOS privacy permissions, and all belong to weftd — the engine — not to the WeftBar menu-bar app you can see. macOS grants these per binary, so granting them to WeftBar does nothing at all.

Permission What it is for Required
Accessibility Moving, resizing and focusing windows Yes
Input Monitoring Keybinds and mouse gestures Usually covered by Accessibility
Screen Recording Reading window titles — rules, switcher, sketchybar Yes

Screen Recording is not about recording. Without it macOS redacts kCGWindowName for every window weftd does not own, so every title comes back empty: title-matching rules stop matching, and the switcher lists blank rows.

The Setup window takes you through them one at a time. At each step macOS may ask first — choose Open System Settings — and then you find the row named weftd and turn its switch on. Weft notices within a second and moves itself along. Nothing needs restarting.

In practice you will often only be asked for Accessibility. macOS lets a process that already holds Accessibility open an event tap, so keybinds go live the moment that switch flips, and Setup marks Input Monitoring Covered and moves past it rather than claiming you granted it. Turning it on as well is harmless if you would rather have it explicit.

macOS only lists an app after the app asks, and asking is what shows its dialog. So weftd never asks on its own — Setup asks at the step you are on, which is why the dialog appears right after you click and never out of nowhere. If a weftd row still isn't there, the Setup window's "No weftd row in the list?" section reveals the binary in Finder and copies its path — ~/.local/bin is a hidden directory, so the pane's + browser cannot reach it on its own.

Reopen it any time from the menu-bar icon → Permissions…, or:

open -a WeftBar --args --setup
weftctl doctor          # the same checks, in a terminal

System Integrity Protection

Weft never asks you to change it. Nothing weft does needs SIP off, and weft loads no code into any other process.

Feature With SIP on
Tiling, focus, shortcuts, rules, stacks, borders, the switcher Yes
Switching desktops (space focus) Yes — instant
Sending a window to a desktop (space move-window), and a rule's space = "…" Yes — instant, any window
Creating or deleting desktops No — do that in Mission Control

Switching and moving go through SkyLight's bridged window operations, the route yabai 7.1 found that needs no scripting addition. They are private, so weft trusts none of them by its return code: each is self-tested on your macOS build — a move of a window of weft's own at every launch, and a visible switch there and back once per build — and every call is checked by reading the result back from the WindowServer. A macOS update that breaks one costs that feature, loudly, never tiling or the launch: switching falls back to a Dock swipe, and weftctl doctor lists each route and what is lost without it. weftctl doctor --selftest re-runs them all.

Default keybindings

⌥ is Option/Alt. A matched chord is swallowed, so ⌥H moves focus rather than typing ˙. Chords are hardware key positions, so they are identical on QWERTY, Colemak and Dvorak.

Chord Does
⌥H ⌥J ⌥K ⌥L Focus the window left / down / up / right
⌥⇧H ⌥⇧J ⌥⇧K ⌥⇧L Move the focused window that way
⌥1…⌥8 Go to workspace 1–8 (1–5 main display, 6–8 second display)
⌥⇧1…⌥⇧8 Send the focused window to that workspace, and go with it
⌥Tab Back to the workspace you came from
⌥F Zoom the window to fill the space; again to restore
⌥⇧Space Float the window, or put it back in the tiling
⌥V / ⌥⇧V Next window splits vertically / horizontally
⌥\ Flip the split under the focused window
⌥B Even out every split on this space
⌥⇧P Keep the window on every workspace; again to put it back
⌥W ⌥N ⌥P ⌥U Stack: wrap / next / prev / unstack (⌥] ⌥[ work too)
⌥⇧W Every window on this workspace in one stack, and back
⌥⇧B ⌥⇧F Switch this space to bsp / float
⌥⌃H ⌥⌃L Focus the display west / east
⌥` Focus the next display
⌥⌃⇧H ⌥⌃⇧L Send the window to that display and follow it
⌥⇧R Enter resize mode — then h/j/k/l, ⇧ for bigger steps, = to balance, Esc to leave
⌥↩ ⌥E ⌥S Terminal / Finder / Safari: open it, go to it, or hide it when it is in front
Drag a border Resize the two windows either side of it — no modifier, no mode
⌃⌥Space Window switcher
⌘K Keybinding cheatsheet

All of it is configuration — change any of it in ~/.config/weft/weft.toml.

Configuration

One file: ~/.config/weft/weft.toml. Weft watches it and reloads within 100 ms of a save — layout changes, new keybinds and new rules all take effect without restarting anything.

The shipped examples/weft.toml is what a fresh install writes, and it is deliberately generic: workspaces 1–8 pinned by role rather than by monitor, shortcuts only for apps every Mac has, no per-app placement, both integrations off. Per-app placement is in it as commented-out examples. Coming from yabai or skhd? weftctl migrate prints your setup as weft config, and weftctl migrate --write saves it.

[general]
inner-gap = 8
outer-gap = 8
stack-offset = 8                # how far a stack's members peek out
default-layout = "bsp"          # bsp | float
mouse-border-resize = true      # drag a window border to resize, no modifier
mouse-modifier = "alt"          # hold to drag a window by its body
mouse-follows-focus = true
reserve = 0                     # room for an always-on-screen bar

[keys]
"alt-h" = "focus west"
"alt-1" = "space focus 1"
"alt-shift-r" = "mode resize"
"alt-return" = "app toggle com.apple.Terminal"
"alt-shift-return" = "exec open -a Terminal ~"   # anything, through /bin/sh

[mode.resize]
"h" = "resize left 40"
"escape" = "mode default"

[[rule]]
app = "System Settings"
manage = false                  # never tiled, never moved

[[space]]                       # optional — see the note below
label = "term"
layout = "bsp"

Prefer buttons? The menu-bar icon → Settings… is a full editor for the file — gaps with a live preview of what they do, spaces, rules, a keybinding table with a chord recorder, and integrations. It writes back into the same lines, so your comments and any key it does not recognise survive untouched.

open -a WeftBar --args --settings

A note on [[space]]. Each block is a workspace, in the order space focus 1, 2, … count. Declare as many as you like — they are weft's, not macOS desktops, so there is nothing to create in Mission Control.

Commands

Every shortcut runs one of these, and so does weftctl <command>. A direction is west, east, north or south. A display is one of those, next, prev, cycle, first, last, or a number counted west to east.

Command Does
focus <direction> Focus the window that way
move <direction> Move the window that way; it keeps its size
swap <direction> Trade places with the window that way
resize left / right / up / down <px> Grow or shrink the window that way by that many points
split vertical / split horizontal Which way the next window splits this one
window toggle split Flip the split under the window
window toggle zoom-fullscreen Fill the workspace with the window; again to restore
float / float on / float off Float the window, or put it back in the tiling
balance Even out every split on the workspace
stack toggle / next / prev / unstack / all Stacks: several windows in one slot
stack move <direction> / stack split <direction> Join the stack that way / pull that window in
space focus <name or number> Go to a desktop (next, prev, recent)
space move-window <name or number> Send the window there and stay (--follow goes with it)
space layout bsp / float / toggle Change this desktop's layout
space label <name> Name this desktop
focus display <display> Focus another display
move display <display> Send the window to another display (--follow goes with it)
spread [--dry-run] Put 0.9.21's workspaces' windows, and every window a rule names, on their desktops
app toggle <bundle id> Open the app, go to its window, or hide it when it is in front
mode <name> Enter a [mode.<name>] layer; mode default leaves it
exec <shell command> Run anything through /bin/sh

Making a shortcut. In Settings › Shortcuts, click Add Shortcut…, press the keys, and pick what they do from the list of everything above, in plain words, with menus for the details. Add more steps and one key does several things in a row. In the file, it is one line under [keys], and a list runs its commands in order:

"alt-m" = "app toggle com.apple.mail"      # Settings › Choose an app… finds any bundle id
"alt-shift-m" = ["space move-window 3", "app toggle com.apple.mail"]   # several steps, in order
"alt-shift-9" = "space move-window 9 --follow"
"alt-d" = "exec open ~/Downloads"

Command line

weftctl drives a running weftd over a Unix socket. Every keybind is just one of these commands.

weftctl focus east                  # same thing your keybind does
weftctl space focus 3
weftctl exec 'screencapture -i -c'  # run a shell command
weftctl space layout float
weftctl query state                 # JSON: the world as weftd sees it
weftctl query windows
weftctl subscribe --all             # live event stream
weftctl doctor                      # health check: permissions, config, helpers
weftctl bench "focus east" -n 200   # latency histogram + per-phase daemon timings
weftctl rescue                      # bring back any window stranded off every display
weftctl service restart

weftctl doctor is the first thing to run when something is wrong. It reports the daemon's own permissions (not weftctl's — TCC is per binary, and asking the wrong process is how a green checklist sits next to a weft that cannot move a window), validates the config with line numbers, and cross-checks it against reality: rules and keybinds pointing at workspaces that do not exist, integrations switched on whose binary is not installed.

Integrations

What it does Install
JankyBorders Highlight around the focused window, recoloured per layout and per mode brew install FelixKratz/formulae/borders
SketchyBar Fires --trigger weft_event with WEFT_* variables on layout, space and focus changes brew install FelixKratz/formulae/sketchybar

Both are off by default.

Window borders

[integrations.borders]
enabled = true
width = 2.0
style = "round"          # follows each window's own corners; or "square"
active-color = { bsp = "0xff7aa2f7", float = "0xffe0af68" }
inactive-color = "0x40414868"
show-inactive = true     # false borders only the focused window

Weft does not draw borders. JankyBorders does: weftd starts borders, restarts it if it dies (supervise = false turns that off), and passes it the keys above. Every key applies live, from Settings or the file, without restarting either program. args is passed through unchanged for anything weft does not model — gradient(...) colours, blacklist, background_color — and wins over the keys above.

Until 0.9.22 weft drew its own borders inside weftd. That renderer is gone: on real use it spiked the GPU noticeably more than JankyBorders, whatever the two-window benchmark in docs/DESIGN.md §10 said. A file still carrying backend = "native" keeps its borders, drawn by JankyBorders, with a warning to drop the line. radius is read as style (0 is square, anything else round), because JankyBorders has no numeric radius.

Building from source

swift build -c release      # weftd, weftctl, weft-bar
swift test                  # no window manager required
./scripts/build-app.sh      # bundles build/WeftBar.app

Trying a change on your own Mac

scripts/dev.sh runs your checkout in place of the installed weft, with no release in between:

./scripts/dev.sh            # build, install over the current weft, restart it
./scripts/dev.sh logs       # follow what the engine is doing
./scripts/dev.sh check      # doctor, both hide/show self-tests, idle cost
./scripts/dev.sh snapshots  # every Settings pane and Setup page as PNGs
./scripts/dev.sh release    # back to the latest published release

It installs where a release installs and signs with the same local identity, so macOS keeps weft's permissions when you switch between a local build and a release. Your config is left alone. weftctl doctor says when a local build is running, and which commit.

To produce what a release ships — universal binaries for both architectures:

swift build -c release --arch arm64 --arch x86_64
WEFT_PRODUCT_DIR="$PWD/.build/apple/Products/Release" ./scripts/build-app.sh

.build/release is a symlink to the host architecture's products, so the fat binaries do not land there — they go to .build/apple/Products/Release, which is why build-app.sh takes that override.

Releases are cut by tagging. .github/workflows/release.yml refuses to publish a tag that disagrees with WeftVersion.current in Sources/WeftCore/Version.swift, so weftctl --version always matches what was downloaded:

# bump Version.swift, commit, then:
git tag v0.2.0 && git push origin v0.2.0

Use swift build without --target. In this package swift build --target weft-bar can report success while producing a byte-identical binary, so an edit appears to have no effect.

Uninstall

From the app: open Settings (weft icon in the menu bar → Settings…), go to Advanced, and click Uninstall Weft… at the bottom. It asks first, and offers to remove your settings and permissions too. Your windows are left exactly where they are.

From a terminal, with the script that ships inside the app:

~/Applications/WeftBar.app/Contents/Resources/uninstall.sh            # keep your settings
~/Applications/WeftBar.app/Contents/Resources/uninstall.sh --purge    # remove everything
~/Applications/WeftBar.app/Contents/Resources/uninstall.sh --dry-run  # only list what it would remove

(From a release archive or a clone it is ./uninstall.sh or ./scripts/uninstall.sh.)

What it removes:

Kept without --purge
The engine (~/.local/bin/weftd, weftctl) and its login service
WeftBar.app, wherever it is
Logs and temporary files
Your settings (~/.config/weft) ✓ — a reinstall picks up where you left off
Weft's signing identity ✓ — a reinstall keeps its permissions
Weft's rows in Privacy & Security ✓

macOS sometimes keeps a weftd row in Privacy & Security after a purge; select it and press − to clear it.

Layout of the repo

Path
Sources/WeftCore Geometry and the world model. Pure — no I/O, no AppKit, no SkyLight.
Sources/WeftPlatform Accessibility, SkyLight, spaces, displays, permissions.
Sources/WeftConfig TOML parsing and validation of weft.toml.
Sources/WeftInput The event tap, chord matching and modes.
Sources/weftd The daemon.
Sources/weftctl The CLI.
Sources/weft-bar The menu-bar app, Settings, cheatsheet, switcher.
docs/DESIGN.md Why things are the way they are, including the mistakes.
docs/TESTING.md The manual test matrix.
docs/TODO.md What is queued next, and what each item already has in place.

License

MIT — see LICENSE.

About

A tiling window manager for macOS.

Resources

Stars

29 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages