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 pipx

Requires system GTK/XApp bindings first, then install with --system-site-packages so the venv can access them:

sudo apt-get install -y gir1.2-xapp-1.0 python3-gi python3-gi-cairo
pipx install gh-switcher --system-site-packages

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 pip install gh-switcher will fail at runtime on modern Ubuntu/Debian. 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).

Starting on login

The easiest way is via the tray menu — click Start on Login to toggle it. To do it manually, create the XDG autostart entry:

mkdir -p ~/.config/autostart
cat > ~/.config/autostart/gh-switcher.desktop <<EOF
[Desktop Entry]
Type=Application
Name=gh-switcher
Exec=gh-switcher
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
EOF

Remove the file to disable autostart.

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.5.tar.gz (65.1 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.5-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gh_switcher-1.1.5.tar.gz
  • Upload date:
  • Size: 65.1 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.5.tar.gz
Algorithm Hash digest
SHA256 12f05aa00614e32788ddcad6f15dec025243b92c500d69b0151b7999eeca9930
MD5 92280928193a039fd9ff9784f35b051b
BLAKE2b-256 b3b14b7061421a9a2c344ded55011fd3f855320cd09f2b09f5d4f89278150c2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_switcher-1.1.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: gh_switcher-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 14.6 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5d1f7454eb475da9a25716fa5abddd1e3f166fc46bc0dc9859a3fac5c6b94cce
MD5 507f267c1514d668a9f1f83ac3c731ea
BLAKE2b-256 232ff4de9e74dbcc214644eb07e908f4501ae2ced23800df7230c016a70cb67b

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_switcher-1.1.5-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