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.

gh-switcher tray menu

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 and select an account to switch.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: gh_switcher-1.2.0.tar.gz
  • Upload date:
  • Size: 126.0 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.2.0.tar.gz
Algorithm Hash digest
SHA256 009543511350c2a2ae3ae55cb4cc8f110dffe4ae4c8513ce0e4a03224a4d16b8
MD5 4db65334f828aa87ad607beacfc42a6d
BLAKE2b-256 2fbeba3c9d4893916e40b06fc03fbe3beac63d50dfb1f0dbfec9608822a3d873

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: gh_switcher-1.2.0-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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3edc03784d8c8766a8d2d6c64c01508db008890b5345d3665b3ee47ca2414df2
MD5 f6c1f70f70b09cc036d8c4abf17bcd0b
BLAKE2b-256 bdbb5d198bb12144572ff6c7ecccf6ce3438d4320fa76718339c40dbdd6887e3

See more details on using hashes here.

Provenance

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