Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
pull_request:

jobs:
verify:
name: Lint, build, and test
runs-on: macos-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Install tools
uses: jdx/mise-action@v2

- name: Lint and format check
run: mise run lint

- name: Build app bundle
run: mise run build

- name: Run tests
run: mise run test
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
release:
name: Build and attach app bundle
runs-on: macos-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Install tools
uses: jdx/mise-action@v2

- name: Stamp version from tag
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION" packaging/Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $VERSION" packaging/Info.plist
grep -A1 CFBundleShortVersionString packaging/Info.plist | head -n 2

- name: Package app bundle
run: mise run package

- name: Create release with asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
gh release create "$GITHUB_REF_NAME" dist/Timber.zip \
--title "$GITHUB_REF_NAME" \
--generate-notes
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SwiftPM build products and caches
.build/
.swiftpm/

# Packaged app output (built by `make build`)
dist/

# Xcode
*.xcodeproj/
*.xcworkspace/
xcuserdata/
DerivedData/
*.o
*.d

# macOS
.DS_Store
8 changes: 8 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--swiftversion 6.0
--indent 4
--maxwidth 120
--wraparguments before-first
--wrapparameters before-first
--wrapcollections before-first
--ifdef no-indent
--disable unusedArguments
27 changes: 27 additions & 0 deletions .swiftlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
opt_in_rules:
- sorted_imports
- modifier_order
- redundant_nil_coalescing
- force_unwrapping

disabled_rules:
- todo
- trailing_comma

excluded:
- .build
- dist
- DerivedData

line_length: 120
identifier_name:
min_length: 2
excluded:
- id
- x
- y

force_unwrapping:
severity: error

reporter: emoji
28 changes: 28 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version: 5.9
import PackageDescription

let package = Package(
name: "Timber",
platforms: [.macOS(.v14)],
targets: [
// Pure model logic (filter, items, argv), no UI/process deps.
.target(
name: "TimberModel",
path: "Sources/TimberModel"
),
// SwiftUI menubar frontend to the `timber` CLI.
// Requires an Xcode toolchain (SwiftUI macros).
.executableTarget(
name: "Timber",
dependencies: ["TimberModel"],
path: "Sources/Timber",
exclude: ["Artwork"],
resources: [.process("Resources")]
),
.testTarget(
name: "TimberModelTests",
dependencies: ["TimberModel"],
path: "Tests/TimberModelTests"
),
]
)
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,64 @@
# macos-timber
# Timber — macOS menubar frontend to `timber`

A macOS menubar port of [omarchy-timber](https://github.com/nnutter/omarchy-timber)
(the QuickShell bar widget): a timber icon in the menubar plus a popover for
managed Git worktrees. Requires the `timber` CLI and an Xcode toolchain.

## Behavior (mirrors Panel.qml)

- Popover lists existing worktrees as `name@repo` rows, with a fuzzy filter
field (`type worktree@repo`). `@` narrows by repo, e.g. `f@scribble`.
- Typing a qualified `name@repo` that does not exist yet offers a `+` row
to create it (`timber create --no-herdr`), then opens it in Zed.
- Row click or Return opens the worktree in Zed (`zed --new`).
- Selected rows show Zed / Herdr / delete buttons. Herdr runs
`timber herdr space --new` (or creates with `--herdr`) and posts a
notification instead of opening Zed.
- Delete is two-phase: first click arms (red), second click runs
`timber remove`. Any list change or selection move disarms.
- `+` header button opens a `timber repo add <url> [--name]` form.
- Failures post a macOS notification; never silently.
- Keyboard: Up/Down move, Return activates, Esc closes form / clears
filter, Ctrl+U clears.
- Right-click (or Ctrl-click) the menubar icon for a Quit menu;
left-click toggles the popover.

Notes on parity: enumeration is implemented natively with FileManager
(`timber repo list -q` plus a worktree-root scan) instead of the bash +
globstar script, since macOS ships bash 3.2. `timber repo add` here has no
`--alias` flag, so the form has URL + Name only.

## Layout

- `Sources/Timber/TimberApp.swift` — AppKit status item
(left-click popover, right-click Quit menu), popover UI, action state.
- `Sources/Timber/main.swift` — plain AppKit entry point (no
SwiftUI App scene, so no stray windows).
- `Sources/Timber/TimberCommand.swift` — `timber`/`zed`
processes, enumeration, notifications.
- `Sources/Timber/Resources/` — Zed/Herdr action icons,
rasterized from upstream `zed.svg`/`herdr.svg` (originals kept in
`Artwork/`; the Herdr glyph was stripped of its light-mode background
and whitened so both render as monochrome template images).
- `Sources/TimberModel/TimberModel.swift` — pure filter/argv logic ported
from `TimberModel.js`, UI-independent.
- `Tests/TimberModelTests/` — unit tests for the model.

## Build & run

Your `xcode-select` may point at the Command Line Tools; the mise tasks
pin `DEVELOPER_DIR` to Xcode explicitly (or run
`sudo xcode-select -s /Applications/Xcode.app` once).

```sh
mise run # builds dist/Timber.app and opens it (recommended)
mise test # swift test (TimberModel suite)
mise lint # SwiftLint (strict) + SwiftFormat check
mise format # format Sources and Tests in place
```

`mise run` ships a real `.app` bundle (with `LSUIElement`, so no Dock
icon). That also matters for notifications: `UNUserNotificationCenter`
traps in a raw binary, so the app posts native notifications only from
the bundle and falls back to `osascript display notification` otherwise
(e.g. `swift run Timber`).
5 changes: 5 additions & 0 deletions Sources/Timber/Artwork/herdr.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Sources/Timber/Artwork/zed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sources/Timber/Resources/herdr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sources/Timber/Resources/herdr@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sources/Timber/Resources/herdr@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sources/Timber/Resources/zed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sources/Timber/Resources/zed@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Sources/Timber/Resources/zed@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading