Skip to content

app_switcher

This directory provides the core implementation of the application switcher and launcher for Talon. It enables hands-free switching, focusing, and launching of applications across macOS, Windows, and Linux operating systems.

It handles:

  • Dynamic detection of running applications.
  • Scanning systems to index launchable applications.
  • Generating automatic spoken forms (voice-triggerable names) for applications while filtering out noisy words.
  • Allowing manual spoken-form overrides and exclusions via platform-specific CSV files.
  • Providing user actions to focus specific app windows or launch applications.

Core Component

app_switcher.py

This is the primary Python script that handles the orchestration, platform detection, and window/application management. It exposes two Talon lists: * self.running: Active applications currently running in the foreground. * self.launch: Applications installed on the system that are available to be launched.

The file implements a series of platform-specific discovery routines for launchable applications:

  • Windows: Queries the Windows Shell (shell:AppsFolder) using ctypes and COM (win32com) APIs to retrieve both legacy desktop applications and Modern UWP apps.
  • Linux: Scans standard desktop application directory paths (including XDG directories, Flatpak, and Snap locations) and parses .desktop files for application names and execution arguments.
  • macOS: Recursively scans directory paths such as /Applications and /System/Applications for .app packages.

app_switcher.py also provides several core voice-driven actions:

  • switcher_focus(name): Switches focus to a named running application. If that application is already focused, it cycles through its active windows.
  • switcher_launch(path): Launches a program given its executable path or app identifier.
  • switcher_toggle_running(): Toggles a graphical IMGUI overlay (gui_running) that shows all active applications alongside their active spoken trigger names.

To maintain performance, the application switcher hooks into Talon's system-level events (app_launch and app_close) to dynamically update the self.running list without expensive continuous polling.


Configuration and Spoken Form Overrides

Sometimes, auto-generated spoken forms are hard to pronounce, or users want to exclude specific system tasks from being triggered accidentally. The following platform-specific CSV files allow users to define manual spoken form overrides or exclude applications entirely from the active switcher list:

How Overrides Work

Each CSV file supports two formats:

  1. Override: Provide a custom spoken name mapped to the official application name or executable (e.g., grip, DataGrip).
  2. Exclusion: Provide the application name/executable on its own line (without commas) to completely block the application from being listed or targeted by the switcher.

The app_switcher.py script registers a file watcher on these CSV files. Any changes made to them are updated instantly in memory without requiring a restart of Talon.