Skip to content

[Enhancement]: Customization — Environment Variable Editor (PATH management GUI) #331

Description

@laurentiu021

Problem

Editing PATH and environment variables in Windows is painful: a single long textbox, no validation, easy to break things.

Proposed solution

  • GUI for system and user PATH + all environment variables
  • Drag-reorder entries
  • Detect duplicate entries (highlight)
  • Detect non-existent paths (red highlight)
  • Validate before apply
  • Backup/restore env vars
  • Search/filter

Affected tab

Customization (new group)

Activity

  1. added 2 commits that reference this issue on Jun 24, 2026
    3c1702e
    ae8bd17
  2. laurentiu021 commented on Jun 24, 2026

    @laurentiu021
    OwnerAuthor

    Shipped in v1.22.0.

    The Customization group's Environment Variables tab is now fully implemented — a proper GUI for editing User and System variables, with the dedicated PATH editor this issue asked for.

    What it does

    • Lists User and System variables in one grid; filter by scope and search by name or value.
    • Edit values in place, and add or remove variables.
    • Dedicated PATH editor for PATH-like variables: reorder directories (up/down), remove entries, and strip duplicates in one click.
    • Missing folders are highlighted so dead PATH entries are obvious at a glance.
    • Validation before apply: variable names are checked at the trust boundary (no =, no whitespace, no leading digit, no shell metacharacters).
    • Backup/restore: a one-time JSON snapshot of every variable is written before the first change, so the original environment is recoverable.

    How it's built

    • EnvironmentVariableService reads/writes both scopes via Environment.SetEnvironmentVariable, which broadcasts WM_SETTINGCHANGE so new terminals pick up changes without a reboot. It mirrors the existing HostsFileService backup contract and PrivacyService's elevation-aware writes (a denied System-scope write returns gracefully instead of throwing). PATH split/join/dedupe are pure, unit-tested helpers.
    • EnvironmentVariablesViewModel follows the existing staged-edit pattern (baseline + pending-change count, Apply/Discard, DialogService confirmation, admin elevation banner). System-scope edits require administrator; User-scope edits don't.
    • EnvironmentVariablesView reuses the standard tab layout, styles, and accessibility conventions.

    Verification

    • 20 unit tests: name validation (accept/reject, including injection-ish and overlong inputs), PATH split/join round-trips, deduplication (case-insensitive, trailing-slash aware), and backup create/no-overwrite/corrupt/missing handling.

    Install: winget upgrade laurentiu021.SysManager or grab the portable .exe from the v1.22.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions