Skip to main content

System tray app for switching between multiple GitHub accounts with git identity management

Project description

github-account-switcher

A lightweight system tray app for switching between multiple GitHub accounts (gh CLI) with a single click. Each account can carry its own git identity (name + email), which is applied automatically on switch.

Platform support

Platform Status
Linux (X11, XApp-compatible desktop) ✓ Supported
macOS Coming soon
Windows Coming soon

Features

  • System tray icon showing the active account's initials
  • One-click account switching via gh auth switch
  • Per-account git identity (user.name / user.email) applied on switch
  • First-run auto-populates config from current git config --global
  • Start on login (XDG autostart)

Requirements

  • Ubuntu 24.04+ / Debian 12+ (Python 3.12 required)
  • gh CLI with at least one authenticated account
  • System packages: gir1.2-xapp-1.0, python3-gi, python3-gi-cairo

Installation

From a release .deb (recommended)

Download the .deb from the latest release and install with:

sudo apt install ./gh-switcher_<version>_amd64.deb

apt resolves the system package dependencies automatically. After installation, gh-switcher is available on your PATH.

via curl

One-line install — fetches and runs the installer script:

curl -fsSL https://raw.githubusercontent.com/panthrocorp/github-account-switcher/main/install.sh | bash

Installs to ~/.local/share/gh-switcher and links the binary to ~/.local/bin/gh-switcher. Re-running upgrades to the latest release.

via pip

For users who prefer full control over the install. Because python3-gi and gir1.2-xapp-1.0 are system packages not available on PyPI, a plain pip3 install gh-switcher will fail at runtime. Use a venv with --system-site-packages instead:

# System deps (once)
sudo apt-get install -y gir1.2-xapp-1.0 python3-gi python3-gi-cairo

# Create an isolated venv that can see the system GTK bindings
python3 -m venv --system-site-packages ~/.local/share/gh-switcher
~/.local/share/gh-switcher/bin/pip install gh-switcher
ln -sf ~/.local/share/gh-switcher/bin/gh-switcher ~/.local/bin/gh-switcher

From source

# Install system dependencies
sudo apt-get install -y gir1.2-xapp-1.0 python3-gi python3-gi-cairo

# Clone and install
git clone https://github.com/panthrocorp/github-account-switcher.git
cd github-account-switcher
make install

Run it:

.venv/bin/gh-switcher

The venv is created with --system-site-packages so the GTK/XApp bindings (system packages) are accessible.

Usage

Launch gh-switcher — the tray icon appears in your system tray. Left-click (or right-click) to open the menu:

✓  alice
   alice-work
──────────────────
Refresh
Configure accounts...
Start on Login [ ]
──────────────────
Quit

Toggle Start on Login to add or remove the XDG autostart entry (~/.config/autostart/gh-switcher.desktop).

Configuration

On first run, ~/.config/gh-switcher/accounts.toml is created automatically. The active account is populated from your current git config --global; other accounts get stub entries to fill in:

[alice]
name = "Alice Smith"
email = "alice@example.com"

[alice-work]
name = "Alice Smith (Work)"
email = "alice@work.example.com (set me)"

Click Configure accounts... in the tray menu to open the file in your default editor.

Development

make lint       # ruff check src/ tests/
make format     # ruff format src/ tests/
make test       # pytest + bats (test-py + test-bash)
make test-py    # pytest unit tests only
make test-bash  # bats shell tests only (install.sh)

Releasing

Releases are driven by semantic-release via GitHub Actions on push to main. Commit messages must follow the convention:

Prefix Release
fix: patch
feat: minor
breaking: major

Licence

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gh_switcher-1.1.4.tar.gz (64.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gh_switcher-1.1.4-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file gh_switcher-1.1.4.tar.gz.

File metadata

  • Download URL: gh_switcher-1.1.4.tar.gz
  • Upload date:
  • Size: 64.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gh_switcher-1.1.4.tar.gz
Algorithm Hash digest
SHA256 eb330b2085112cfd86b28379636f50c253fb8d5c89f54218d87423dcf3347540
MD5 dbc7302a6bffc1b96a7b3f6610016762
BLAKE2b-256 8464033f406de6763ba1525b5e8a46fa1b7f6eafc73d087b595d9350129e0e03

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_switcher-1.1.4.tar.gz:

Publisher: publish.yml on panthrocorp/github-account-switcher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gh_switcher-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: gh_switcher-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gh_switcher-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a27b1ccda94efe87194c099eb74c6ebafd10d9d2b04e9a288996a341828e95c5
MD5 c9ecd4fab3960f1c82127acd4d9f30b3
BLAKE2b-256 d44f29ddde34059bf49b1dd443218e1636ef2d8cd54e92b921d5ed2520dc44e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_switcher-1.1.4-py3-none-any.whl:

Publisher: publish.yml on panthrocorp/github-account-switcher

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page