Daily work¶
Task-first recipes. Each one names the page with the full reference.
Open a project¶
- Type
workon <name>. Names match loosely, sothumb.imandthumb-imboth work. - If the project is on this Mac or has no machine recorded, you are now in its directory with the venv active.
- If it lives on another Mac,
workonrunsmoshthere and, when the entry hastmux = true, attaches its session.
Add --tmux to attach a session for a project that normally does not use one.
Add --local or --remote to override the registry for one run. Details in
Project Registry.
Start a new project¶
- Run
mkproject <name>. Add--workfor~/Work,--tmuxfor a tmux session,--machine studioto record an owner. mkprojectcreates the directory, a uv venv, and an.envrcwithlayout uvand, with--tmux,use tmux.- It registers the project and opens it.
The directory reaches the other Macs through Syncthing within a minute. The
venv does not travel; direnv rebuilds it on first entry. Use --no-attach to
create without opening, --dry-run to see the commands without running them,
and --path DIR for a location outside ~/Projects and ~/Work.
See what is running everywhere¶
- Run
workon --sessions(orworkon -s). - Read the right-hand column. It is the exact
workoncommand that opens each session.
Filters: -a for attached sessions only, -m studio for one Mac, --names
for bare names to pipe into fzf:
tmux-remote-ls answers the lower-level question of which sessions exist,
with window counts and paths. See tmux.
Kill a session, wherever it is¶
- Run
workon -s --kill <name>. The name can be the project key or the tmux session name. - Read the confirmation. It shows the Mac, the window count, and the directory.
- Answer
y, or pass--yesto skip the prompt.
If the name matches sessions on more than one Mac, the command refuses and
tells you. Pick the Mac with -m.
Work on another Mac¶
- Check the machine is registered:
projects machines. - Open the project with
workon <name> --host studio. That is amoshtomac-studio-2023in the project directory. - For a session that should stay there, set it in the registry once:
projects set <name> --machine studio --tmux.
A project with no machine opens wherever you are, which is the right answer for anything Syncthing mirrors. See Machine List for how names resolve.
Keep cmux workspaces in step with tmux¶
cmux-tmux-sync --dry-runshows which detached local sessions have no workspace.cmux-tmux-synccreates them. Add--allto include the other Macs as mosh workspaces.cmux-tmux-watchkeeps doing this on a five-second interval.
To save the current layout, cmux-dump-save writes
~/.config/cmux-tmux/session-dump.toml; cmux-dump-restore rebuilds it, skipping
workspaces that already exist. See cmux Workspaces.
Arrange windows¶
| Want | Press |
|---|---|
| Half screen | hyper + arrow |
| Quarter screen | ctrl + opt + shift + arrow |
| Next or previous monitor | ctrl + opt + right/left |
| Maximize, center, snap back | hyper + m, hyper + c, hyper + z |
| Show the grid | hyper + g |
| Toggle an app | hyper + letter, see the table in Hammerspoon |
| Fix the 2x2 monitor layout | hyper + f |
hyper is ctrl + opt + cmd.
Reload a config after editing it¶
| Config | How |
|---|---|
| tmux | prefix + r inside tmux, or start a new server |
| Hammerspoon | hyper + r |
| Shell | open a new shell; the files are symlinks, so there is nothing to copy |
| direnv | direnv allow in the project after editing its .envrc |
| Registry | nothing; workon reads projects.toml on every call and the completion cache refreshes itself |
Copy text out of tmux¶
Select with the mouse, or v then y in copy mode. The text goes to the
system clipboard through OSC 52, on every Mac and over ssh. Over mosh it does
not; use the terminal's own modifier-drag there. See
Troubleshooting.