Skip to content

gcclinux/EasyContextSwitch

Repository files navigation

EasyContextSwitch

A blazing-fast, ultra-lightweight Windows desktop utility that eliminates context-switching fatigue. Define workspace profiles and activate entire development environments — applications, background services, browser tabs, and precise window layouts — with a single click or global hotkey.

EasyContextSwitchBanner

EasyContextSwitch

The Problem

Every professional who uses a computer to make a living experiences context-switching fatigue. Opening specific browser tabs, spinning up local containers, launching an IDE to a precise path, starting a database GUI, and positioning windows exactly where you want them takes 5–10 minutes every time you switch tasks. If you switch 3 times a day, that's nearly 2.5 hours wasted per week just setting up your screen.

The Solution

EasyContextSwitch is a 1-click desktop state manager. You create workspace profiles, and when you activate one, the app automatically:

  • Runs environment scripts (e.g. docker-compose up)
  • Launches your IDE with the right project folder
  • Opens browser sessions with specific URLs
  • Snaps all windows into your preferred multi-monitor layout
  • Tears down the previous workspace cleanly before spinning up the next

Features

  • Workspace Profiles — Create named profiles with ordered launch sequences and teardown rules
  • Global Hotkeys — Activate any workspace instantly with a custom keyboard shortcut (e.g. Ctrl+Alt+A)
  • Window Snapping — Automatically position and resize application windows across multiple monitors using native Windows APIs
  • Launch Sequences — Define ordered steps: background processes, GUI applications, and browser URLs
  • Teardown Sequences — Safely kill processes and run cleanup commands when switching contexts
  • Docker Integration — Detect Docker status and orchestrate container lifecycles as part of your workspace
  • Multi-Monitor Support — Query physical displays and position windows with per-monitor DPI awareness
  • Import / Export — Backup and share workspace configurations as ZIP archives
  • Real-Time Logging — Live streaming console shows every engine action as it happens
  • System Tray — Runs quietly with minimal idle RAM footprint (< 30MB)

Tech Stack

Layer Technology
Backend Engine Go (Golang)
UI Framework Wails v2 (Go + HTML/JS/CSS webview)
Frontend Vanilla JS + Vite
Window Management Native Win32 API via golang.org/x/sys/windows
Global Hotkeys golang.design/x/hotkey
State Storage Local JSON files in %APPDATA%/EasyContextSwitch/

Architecture

+---------------------------+
|   UI / System Tray Layer  |
|   (Wails WebView + HTML)  |
+-------------+-------------+
              |
+-------------v-------------+
|   EasyContextSwitch Core  |
|        (Go Engine)        |
+-------------+-------------+
              |
+------+------+------+
|      |      |      |
v      v      v      v
Config  Process  Window  Hotkey
Manager Engine   Engine  Manager
(JSON)  (exec)  (Win32) (global)

Core Modules

  • Config Manager — CRUD operations on workspace JSON files stored in %APPDATA%
  • Process Engine — Launches executables, captures PIDs, manages async process lifecycles
  • Window Engine — Enumerates windows via EnumWindows, matches by PID/title, positions with SetWindowPos
  • Hotkey Manager — Registers system-wide keyboard shortcuts that trigger workspace activation

Workspace Configuration Schema

Workspaces are defined as JSON files with the following structure:

{
  "workspace_id": "proj_alpha_backend",
  "name": "Project Alpha - Go Backend",
  "hotkey": "Ctrl+Alt+A",
  "launch_sequence": [
    {
      "step": 1,
      "type": "background_process",
      "executable": "powershell.exe",
      "arguments": ["-Command", "cd C:\\dev\\alpha; docker-compose up -d"],
      "wait_for_completion": true
    },
    {
      "step": 2,
      "type": "application",
      "executable": "C:\\...\\Code.exe",
      "arguments": ["C:\\dev\\alpha"],
      "window_rules": {
        "title_match": "alpha",
        "monitor": 1,
        "x": 0,
        "y": 0,
        "width": 1280,
        "height": 1440
      }
    },
    {
      "step": 3,
      "type": "url",
      "executable": "",
      "arguments": ["http://localhost:8080/health", "https://github.com"]
    }
  ],
  "teardown_sequence": [
    {
      "type": "command",
      "executable": "powershell.exe",
      "arguments": ["-Command", "cd C:\\dev\\alpha; docker-compose down"]
    },
    {
      "type": "kill_process",
      "process_name": "Code.exe"
    }
  ]
}

Step Types

Type Description
background_process Runs a script or service. Can block until completion or run async.
application Launches a GUI app and optionally snaps its window to a layout grid.
url Opens URLs in the default browser or a specified browser executable.

Teardown Types

Type Description
command Executes a cleanup script (e.g. docker-compose down).
kill_process Forcefully terminates a process by name via taskkill.

How It Works

  1. Activate — User clicks a workspace card or presses its global hotkey
  2. Teardown — If another workspace is active, its teardown sequence runs first
  3. DPI Awareness — Sets process DPI context for correct multi-monitor coordinate mapping
  4. Launch — Steps execute sequentially in order: background processes, apps, URLs
  5. Window Polling — For GUI apps, a background goroutine polls every 200ms (up to 15s) for the target window handle
  6. Snap — Once found, SetWindowPos places the window at the configured coordinates with retry passes at 300ms and 1s to override apps that restore their own positions on startup

Getting Started

Prerequisites

Build

# Install Wails CLI
go install github.com/wailsapp/wails/v2/cmd/wails@latest

# Clone the repository
git clone https://github.com/your-username/EasyContextSwitch.git
cd EasyContextSwitch

# Run in development mode
wails dev

# Build production binary
wails build

The compiled binary will be in the build/ directory.

Usage

  1. Launch EasyContextSwitch — it opens a frameless glassmorphic window
  2. Create a workspace profile with your desired launch steps and window positions
  3. Assign a global hotkey (e.g. Ctrl+Alt+A)
  4. Press the hotkey or click Activate to spin up your entire environment
  5. Switch to another workspace — the previous one tears down automatically

Target Audience

  • Freelancers juggling multiple client projects
  • DevOps engineers managing different infrastructure environments
  • Full-stack developers switching between frontend/backend/microservice contexts
  • Sysadmins maintaining multiple server configurations

License

Copyright © 2026 EasyContextSwitch. All rights reserved.

Architecture Diagram (EasyContextSwitch)

graph TB
    subgraph UI_Layer ["UI / Presentation Layer (Wails WebView)"]
        A["HTML5 / CSS3 / JS Frontend"] <-->|Wails IPC / JSON-RPC| B["Wails Runtime Bridge"]
    end

    subgraph Go_Core_Engine ["Go Core Engine (Micro-Kernel)"]
        B <-->|Go Struct Bindings| C["Orchestrator Service"]
        C -->|Log Events| D["Event Bus / Go Channels"]
        D -->|"Real-Time Logs"| B

        subgraph Subsystems ["Subsystems"]
            E["Config Manager"]
            F["Process Engine"]
            G["Window Engine"]
            H["Hotkey Manager"]
        end

        C <-->|Read / Write Profiles| E
        C <-->|Spawn / Monitor PIDs| F
        C <-->|Query / Move Windows| G
        C <-->|Register / Listen| H
    end

    subgraph OS_Integration_Layer ["OS Integration Layer"]
        E -->|Atomically Write| I["Local AppData %APPDATA%"]
        F -->|CreateProcess / TerminateProcess| J["Windows OS Kernel"]
        G -->|EnumWindows / SetWindowPos| K["User32.dll / Dwmapi.dll"]
        H -->|RegisterHotKey / Msg Loop| L["Windows Win32 Messaging"]
    end

    %% Style Classes
    classDef UI fill:#1e1e2e,stroke:#cba6f7,stroke-width:2px,color:#cdd6f4;
    classDef Go fill:#181825,stroke:#89b4fa,stroke-width:2px,color:#cdd6f4;
    classDef OS fill:#11111b,stroke:#f38ba8,stroke-width:2px,color:#cdd6f4;

    %% Apply Styles
    class A,B UI;
    class C,D,E,F,G,H Go;
    class I,J,K,L OS;
Loading

About

A blazing-fast, ultra-lightweight Windows desktop utility that eliminates context-switching fatigue. Define workspace profiles and activate entire development environments — applications, background services, browser tabs, and precise window layouts — with a single click or global hotkey.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors