Skip to content

ygsgdbd/TypeSwitch

Repository files navigation

TypeSwitch 🔄

TypeSwitch is a macOS menu bar utility for switching input methods per app.

System-native appearance - TypeSwitch uses SwiftUI menu bar controls and follows macOS light and dark mode.

✨ Screenshots

Main Interface

Menu Bar Interface - Set default input method for different applications

🎯 Features

  • 🔄 Auto Switch: Switch input methods when changing apps
  • 📱 Menu Bar Interface: View and set rules quickly
  • 🎯 Per-App Settings: Configure each app independently
  • 🚀 Auto Start: Run automatically at login
  • 📋 Running Apps: Configure current apps directly
  • ⚙️ Configured Apps: Manage existing settings
  • ⌨️ Keyboard Shortcuts:
    • ⌘ + Q - Quit application
  • 🔗 Quick Links: Direct access to GitHub repository and latest releases

🔧 System Requirements

  • 🖥 macOS 14.0 or later
  • 🔐 Accessibility permission for monitoring application switches
  • ⌨️ Input method switching permission

📦 Installation

🍺 Option 1: Homebrew

brew install ygsgdbd/tap/typeswitch --cask

💾 Option 2: Manual Installation

  1. Download the latest version from Releases
  2. Drag the application to Applications folder
  3. Grant necessary system permissions on first launch

📖 Usage

  1. After launching, the app icon (⌨️) appears in the menu bar
  2. Click the menu bar icon to open the dropdown menu
  3. Pick an app from Running Apps or Configured Apps
  4. Choose Follow global setting, Remember Last, or a fixed input method
  5. TypeSwitch switches input methods when that app becomes active
  6. Use Settings for the global rule and launch at login

🔒 Security

TypeSwitch takes user privacy and security seriously:

  • 🏠 All data is stored locally, nothing is uploaded to the network
  • 🚫 No user information or usage data is collected
  • 📖 Source code is fully open source and welcome for review
  • 🛡️ Uses Swift's built-in security features
  • 🔐 Permission usage:
    • Accessibility: Only used for detecting application switches
    • Input method switching: Only used for switching input methods
    • Auto-start: Only used for launching at startup

Dependencies

This project uses the following open source libraries:

  • Defaults (7.3.1) - For persistent settings storage
  • SwiftUIX (0.2.3) - Provides additional SwiftUI components
  • SwifterSwift (8.0.0) - Swift native extensions

Build tools:

  • Tuist - For project generation and management

Development

Requirements

  • Xcode 15.0+
  • Swift 5.9+
  • macOS 14.0+
  • Tuist

Build Steps

  1. Install Tuist

  2. Clone repository

git clone https://github.com/ygsgdbd/TypeSwitch.git
cd TypeSwitch
  1. Generate Xcode project
tuist generate
  1. Open and build
open TypeSwitch.xcworkspace

Automated Build and Release

This project uses GitHub Actions for automated building and releasing:

  1. Push a new version tag to trigger automatic build:
git tag v1.0.0
git push origin v1.0.0
  1. GitHub Actions will automatically:

    • Build the application
    • Create DMG package
    • Release new version
    • Generate changelog
  2. Build artifacts can be downloaded from Releases

Project Structure

TypeSwitch/
├── Project.swift                    # Tuist project configuration
├── Tuist/                          # Tuist configuration files
│   └── Signing/
│       └── TypeSwitch.entitlements
├── TypeSwitch/                     # Main source code
│   ├── Sources/
│   │   ├── App/                    # App entry point
│   │   │   └── TypeSwitchApp.swift
│   │   ├── Core/                   # Core models and extensions
│   │   │   ├── Models/
│   │   │   │   ├── AppInfo.swift
│   │   │   │   ├── InputMethod.swift
│   │   │   │   └── InputSourceProperties.swift
│   │   │   └── Extensions/
│   │   │       └── Defaults+Extensions.swift
│   │   ├── Services/               # Business logic services
│   │   │   ├── AppManagement/
│   │   │   │   ├── AppInfoService.swift
│   │   │   │   └── AppListService.swift
│   │   │   ├── InputMethod/
│   │   │   │   ├── InputMethodManager.swift
│   │   │   │   └── InputMethodService.swift
│   │   │   └── System/
│   │   │       └── LaunchAtLoginService.swift
│   │   └── UI/                     # User interface
│   │       └── Views/
│   │           └── MenuBar/        # Menu bar interface
│   │               ├── MenuBarView.swift
│   │               ├── RunningAppsView.swift
│   │               ├── ConfiguredAppsView.swift
│   │               ├── AppRowView.swift
│   │               ├── SettingsView.swift
│   │               └── AppInfoView.swift
│   └── Resources/                  # App resources
│       ├── Assets.xcassets/        # App icons and images
│       └── *.lproj/               # Localization files
└── Screenshots/                   # App screenshots

Contributing

Pull requests and issues are welcome. Before submitting a PR, please ensure:

  1. Code follows project style
  2. Necessary tests are added
  3. Documentation is updated

License

This project is licensed under the MIT License. See LICENSE file for details.

Acknowledgments 🙏

This project was inspired by and received help from:

  • SwitchKey - An excellent input method switcher that provided valuable reference
  • Swift and SwiftUI community
  • All contributors and users who provided feedback

About

A macOS app that automatically switches input methods for different applications. 自动切换不同应用输入法的 macOS 应用。

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages