Skip to content
markksantosPublic

About

Project Workspace Switcher for macOS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

Flux

A native macOS menu-bar app for switching between project contexts in one click.

Each context bundles the apps, URLs, files, and folders you use for a given project, plus an optional global hotkey and built-in time tracking. Activate a context and Flux launches everything and starts the clock; switch to another and it logs your time and sets up the new workspace.

Flux icon

Features

  • Project contexts — name, color, and SF Symbol icon per context.
  • One-click activation — launches the context's apps, opens its URLs in the default browser, and reveals/opens its files & folders.
  • Time tracking — a live timer runs while a context is active; completed sessions are saved as time entries and rolled up into a per-context total. Pause/resume and stop from the popover.
  • Global + per-context hotkeys — a global hotkey toggles the popover; each context can have its own hotkey to switch directly to it from anywhere.
  • Drag-to-reorder — reorder contexts directly in the popover list.
  • Launch at login — optional, via the modern SMAppService API.
  • Menu-bar timer — optionally show the active context's elapsed time in the menu bar.
  • Local-only & private — all data is stored as JSON in ~/Library/Application Support/Flux/contexts.json. No network, no third-party dependencies, no accounts.

Requirements

  • macOS 14.0 (Sonoma) or later
  • Xcode 16+ (the project is generated with XcodeGen; the bundled .xcodeproj also works directly)
  • XcodeGen — brew install xcodegen (only needed to regenerate the project)

Build & run

The Xcode project is generated from project.yml by XcodeGen. The generated Flux.xcodeproj is committed, so you can open it directly — but regenerate it after editing project.yml or adding/removing source files.

# 1. (Re)generate the Xcode project from project.yml
xcodegen generate

# 2. Build (Debug)
xcodebuild -project Flux.xcodeproj -scheme Flux -configuration Debug build

# 3. Run the tests
xcodebuild -project Flux.xcodeproj -scheme Flux -configuration Debug test

# 4. Or just open it in Xcode and press ⌘R
open Flux.xcodeproj

Flux is a menu-bar agent (LSUIElement), so it has no Dock icon — look for the swap-arrows icon in the right side of the menu bar after launching.

Project layout

Flux/
├── FluxApp.swift              # @main App; hosts the Settings scene
├── AppDelegate.swift          # Boots the menu-bar manager + hotkey monitor
├── Info.plist                 # Bundle metadata (values via build-setting substitution)
├── Flux.entitlements          # App sandbox disabled (needs to launch arbitrary apps/files)
├── Models/                    # Codable value types: FluxContext, AppReference, URLReference,
│                              #   FileReference, HotkeyBinding, TimeEntry, AppSettings
├── Services/
│   ├── PersistenceService     # JSON load/save of contexts to Application Support
│   ├── ContextLaunchService   # Opens apps / URLs / files when a context activates
│   ├── TimeTrackingService    # Live session timer + pause/resume
│   ├── HotkeyService          # Global + local NSEvent monitors for hotkeys
│   └── LoginItemService       # SMAppService launch-at-login
├── ViewModels/
│   ├── ContextListViewModel   # Owns the contexts; switch/create/update/delete/reorder
│   └── ContextEditorViewModel # State for the create/edit editor window
└── Views/
    ├── MenuBar/               # MenuBarManager (NSStatusItem + NSPopover) + popover UI
    ├── ContextList/           # ContextRowView
    ├── ContextEditor/         # Editor window + color/icon picker
    ├── Settings/              # SettingsView (General / Hotkeys / About)
    └── Components/            # ShortcutRecorderView, Color(hex:) extension
FluxTests/                     # XCTest unit tests for models, time formatting, editor logic
project.yml                    # XcodeGen project definition (source of truth)

Architecture notes

  • MVVM. @MainActor view models hold app state; SwiftUI views observe them via @EnvironmentObject. AppKit (NSStatusItem, NSPopover, NSOpenPanel, NSEvent monitors) is used where SwiftUI lacks the capability.
  • No sandbox. com.apple.security.app-sandbox is false because the app must launch arbitrary applications and open arbitrary files the user chooses. This means the app cannot ship on the Mac App Store as-is (see Distribution below).
  • Hotkeys use NSEvent global/local monitors. The global monitor requires the user to grant Accessibility permission (System Settings → Privacy & Security → Accessibility) for hotkeys to fire while other apps are focused.
  • Persistence is a single pretty-printed JSON file; the data model is plain Codable value types, so the format is stable and inspectable.

Distribution

The app currently builds with ad-hoc signing (CODE_SIGN_IDENTITY = "-"). To distribute it:

  1. Set your Apple Developer Team ID in project.yml under targets.Flux.settings.base.DEVELOPMENT_TEAM, then xcodegen generate.
  2. Archive a Release build:
    xcodebuild -project Flux.xcodeproj -scheme Flux -configuration Release \
      -archivePath build/Flux.xcarchive archive
  3. Export and notarize (required for distribution outside the App Store):
    xcodebuild -exportArchive -archivePath build/Flux.xcarchive \
      -exportPath build/export -exportOptionsPlist ExportOptions.plist
    xcrun notarytool submit build/export/Flux.app --keychain-profile "AC_NOTARY" --wait
    xcrun stapler staple build/export/Flux.app

Mac App Store: not currently possible — the App Store requires the app sandbox, which would block Flux's core ability to launch arbitrary apps and open arbitrary files. Direct (notarized) download is the intended distribution channel.

License

Personal project. All rights reserved.

About

Project Workspace Switcher for macOS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages