Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Window Switcher

A lightweight macOS menu bar app for switching between windows of the same app.

轻量的 macOS 菜单栏工具,用于在同一应用的多个窗口间快速切换。

Platform Swift License


Overview / 概述

macOS natively cycles through windows of the same app with + `, but offers no visual way to pick a specific one. Window Switcher fixes that — press + ` and a focused panel instantly appears, showing all windows of the frontmost app. Keep holding and tap ` to move the selection; release to jump straight to that window.

macOS 原生的 + ` 只能按顺序循环切换窗口,无法可视化选择。Window Switcher 解决了这个问题 — 按下 + ` 即弹出面板,展示当前应用的所有窗口;保持按住 并连按 ` 移动选中项,松开 即跳转至目标窗口。


Features / 功能

  • Global hotkey + ` triggers the switcher from any app, no need to switch to Window Switcher first
  • Visual panel — centered floating panel with native vibrancy (light/dark mode adaptive)
  • Keyboard driven + ` / + + ` to cycle forward/backward; / arrow keys to move selection; Esc to cancel
  • Click to switch — click any card in the panel to switch immediately
  • Launch at login — optional, configurable from the menu bar
  • Zero footprint — lives in the menu bar, no Dock icon, no main window

  • 全局快捷键 — 从任意应用按 + ` 即可触发,无需切换至 Window Switcher
  • 可视化面板 — 居中悬浮面板,原生毛玻璃效果,自动适配浅色/深色模式
  • 键盘驱动 + ` / + + ` 向前/向后循环; / 方向键移动选中项;Esc 取消
  • 点击切换 — 直接点击面板中的窗口卡片立即切换
  • 开机启动 — 可在菜单栏中开启
  • 零存在感 — 常驻菜单栏,无 Dock 图标,无主窗口

Requirements / 系统要求

  • macOS 13 Ventura or later
  • Accessibility permission (the app will prompt on first launch)

  • macOS 13 Ventura 及以上
  • 辅助功能权限(首次启动时会自动提示授权)

Installation / 安装

Build from source / 从源码构建

  1. Clone the repository:
    git clone https://github.com/YOUR_USERNAME/window-switcher.git
    cd window-switcher
  2. Open Window Switcher.xcodeproj in Xcode.
  3. Select your target device (My Mac) and press ⌘R to build and run.

  1. 克隆仓库:
    git clone https://github.com/YOUR_USERNAME/window-switcher.git
    cd window-switcher
  2. 用 Xcode 打开 Window Switcher.xcodeproj
  3. 选择目标设备(My Mac),按 ⌘R 构建并运行。

Usage / 使用方法

Action Shortcut
Open switcher + `
Cycle forward Hold , press `
Cycle backward Hold + , press `
Move up / down /
Confirm & switch Release
Click to switch Mouse click on a card
Cancel Esc

Architecture / 架构

AppEntrypoint (SwiftUI MenuBarExtra)
    ├── HotkeyMonitor      — global CGEvent tap, intercepts ⌘`
    ├── AccessibilityManager — AX permission checks & refresh
    ├── SwitcherPanelController — NSPanel lifecycle & positioning
    │       └── SwitcherState — selected index, window list (ObservableObject)
    ├── WindowCollector    — fetches windows via Accessibility API (AXUIElement)
    └── WindowActivator    — raises target window via AXUIElement

Built with Swift 5.9+, SwiftUI for UI, and AppKit for low-level window management and event interception.


Permissions / 权限说明

Window Switcher requires Accessibility permission to:

  • Intercept the global `⌘`` hotkey before the system handles it
  • Enumerate windows of the frontmost application via the Accessibility API
  • Raise (bring to front) a selected window

The app does not collect, transmit, or store any user data.


Window Switcher 需要辅助功能权限以实现:

  • 在系统处理之前拦截全局 `⌘`` 快捷键
  • 通过辅助功能 API 枚举当前应用的窗口列表
  • 将选中窗口置于前台

本应用不收集、不传输、不存储任何用户数据。


Contributing / 贡献

Issues and pull requests are welcome. Please open an issue first for major changes.

欢迎提交 Issue 和 Pull Request。重大改动请先开 Issue 讨论。


License / 许可证

MIT © 2026 Jin Zhenzu

About

A lightweight macOS menu bar app for switching between windows of the same app.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages