Skip to content

A desktop environment variable management tool built with Wails (Go + React/TypeScript). SwitchEnvs allows you to manage, save, and switch between multiple environment variable configurations with ease.

Notifications You must be signed in to change notification settings

dean2021/SwitchEnvs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwitchEnvs

A desktop environment variable management tool built with Wails (Go + React/TypeScript). SwitchEnvs allows you to manage, save, and switch between multiple environment variable configurations with ease.

Screenshot

SwitchEnvs Screenshot

Features

  • Multiple Environment Schemes: Create, edit, duplicate, and delete environment variable schemes
  • One-Click Switch: Quickly switch between different environment configurations
  • Persistent Storage: Schemes are saved locally and persist across sessions
  • Shell Integration: Automatically updates your shell environment (~/.switch_env)
  • Import/Export: Share your environment schemes with others
  • Custom Window: macOS-style frameless window with transparent background and rounded corners
  • Auto-Reload: Changes to the currently applied scheme are immediately reflected

Tech Stack

  • Backend: Go with Wails v2
  • Frontend: React 18 + TypeScript + Tailwind CSS
  • Runtime: Native desktop application

Getting Started

Prerequisites

  • Go 1.23+
  • Node.js & npm
  • Wails CLI

Installation

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

# Clone and setup
git clone https://github.com/dean2021/SwitchEnvs.git
cd SwitchEnvs

# Install frontend dependencies
cd frontend && npm install

# Return to project root
cd ..

Development

Run the application in development mode with hot reload:

wails dev

This will start both the Go backend and the React frontend with automatic rebuilding.

Building

Build the production version:

wails build

Build for specific platforms:

# macOS ARM64
wails build -platform darwin/arm64

# Windows AMD64
wails build -platform windows/amd64

# Linux
wails build -platform linux/amd64

Usage

Creating a Scheme

  1. Click "Add Scheme" to create a new environment scheme
  2. Add key-value pairs for your environment variables
  3. Click "Apply" to activate the scheme

Switching Schemes

  • Select a scheme from the sidebar
  • Click "Apply" to switch to that environment configuration

Exporting/Importing

  • Use the export button to save your schemes as JSON
  • Use the import button to load schemes from a JSON file

File Structure

SwitchEnvs/
├── app.go              # Main application logic (Go)
├── main.go             # Application entry point
├── wails.json          # Wails configuration
├── frontend/           # React frontend
│   ├── src/
│   │   ├── App.tsx     # Main React component
│   │   ├── main.tsx    # React entry point
│   │   ├── style.css   # Global styles
│   │   └── types/      # TypeScript type definitions
│   ├── package.json
│   └── vite.config.ts
└── build/              # Build configurations

Data Storage

Path Purpose
~/.switchenvs/schemes.json All saved schemes in JSON format
~/.switchenvs/applied_scheme.json Persisted applied scheme name
~/.switch_env Shell script with export KEY="value" entries

Architecture

Backend (Go)

The Go backend handles:

  • Scheme CRUD operations (Save, Get, Delete, Duplicate)
  • Applying schemes to the system
  • Writing environment variables to shell config
  • Import/Export functionality

Frontend (React + TypeScript)

The frontend provides:

  • Interactive UI for managing environment schemes
  • Real-time updates when switching schemes
  • Import/Export dialogs
  • Custom window controls (minimize, close)

Shell Integration

SwitchEnvs writes environment variables to ~/.switch_env and automatically adds a source command to ~/.zshrc. To use the environment variables in your terminal:

source ~/.switch_env

Or restart your terminal session.

License

MIT License

About

A desktop environment variable management tool built with Wails (Go + React/TypeScript). SwitchEnvs allows you to manage, save, and switch between multiple environment variable configurations with ease.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published