refactor: source variables.sh in toggle scripts instead of hardcoding option keys - #8
Merged
Merged
Conversation
… option keys toggle_on.sh and toggle_off.sh previously hardcoded @remote-saved-status-left and the three @remote-indicator-* option names as raw strings. Any rename in variables.sh would require manual updates in both scripts with no static check to catch drift. Both scripts now set CURRENT_DIR and source variables.sh, using the canonical variable names (saved_status_left_option, indicator_text_option, etc.) defined there. A new saved_status_left_option variable is added to variables.sh to give the save/restore key a single source of truth.
danyim
force-pushed
the
refactor/source-variables-in-toggle-scripts
branch
from
June 16, 2026 22:30
e6355c2 to
f14dadb
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the tmux toggle scripts to avoid hardcoded option key strings by sourcing scripts/variables.sh and reusing the canonical option-key variables, reducing drift risk when option names change.
Changes:
- Add
saved_status_left_optiontoscripts/variables.shas the canonical key for storing/restoringstatus-left. - Update
scripts/toggle_on.shandscripts/toggle_off.shto computeCURRENT_DIR, sourcevariables.sh, and use the named option-key variables. - Document the refactor in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| scripts/variables.sh | Adds a canonical option-key variable for saved status-left. |
| scripts/toggle_on.sh | Sources variables.sh and replaces hardcoded option keys with variables. |
| scripts/toggle_off.sh | Sources variables.sh and replaces hardcoded option keys with variables. |
| CHANGELOG.md | Notes the refactor to centralized option-key variables. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
toggle_on.shandtoggle_off.shhardcoded all tmux option key names as raw strings (@remote-saved-status-left,@remote-indicator-text, etc.), duplicating values already defined invariables.sh. A rename invariables.shwould require manual updates in both scripts with nothing catching the drift.How?
Both scripts now set
CURRENT_DIRandsourcevariables.sh, referencing option keys through the canonical variable names. A newsaved_status_left_optionvariable is added tovariables.shto give the save/restore key a single home.