DotState A modern, secure, and user-friendly dotfile manager built with Rust DotState is a terminal-based tool that helps you manage your dotfiles effortlessly. Whether you're syncing your configuration across multiple machines or setting up a new development environment, DotState makes it simple, safe, and fast. Demo https://github.com/user-attachments/assets/9be0df5e-87ce-4b61-ae0f-1c8ffe94cb36 Why DotState…
A modern, secure, and user-friendly dotfile manager built with Rust
DotState is a terminal-based tool that helps you manage your dotfiles effortlessly. Whether you’re syncing your configuration across multiple machines or setting up a new development environment, DotState makes it simple, safe, and fast.
Managing dotfiles can be a pain. You want your .zshrc, .vimrc, and other config files synced across machines, but traditional solutions are either too complex, insecure, or require too much manual work.
DotState solves this by being:
🦀 Built with Rust - Fast, memory-safe, and reliable
🔒 Secure by design - No shell injection vulnerabilities, safe file operations
Tip: You can also set the DOTSTATE_GITHUB_TOKEN environment variable
Choose repository name and visibility (private/public)
Option B: Use my own repository - Bring your own git repo
Create a repo on any git host (GitHub, GitLab, Bitbucket, etc.)
Clone it locally and set up your credentials
Point DotState to your local repo path
Add Your Files:
Navigate to “Manage Files”
Select files to sync (they’re automatically added)
Files are moved to the repo and symlinked automatically
Sync with Remote:
Go to “Sync with Remote”
Your files are committed, pulled, and pushed automatically
That’s it! Your dotfiles are now synced and ready to use on any machine.
CLI Usage
DotState also provides a powerful CLI for automation:
# List all synced files
dotstate list
# Add a file to sync
dotstate add ~/.myconfig
# Sync with remote (commit, pull, push)
dotstate sync
# Sync with custom commit message
dotstate sync -m "My custom commit message"
# Activate symlinks (useful after cloning on a new machine)
dotstate activate
# Deactivate symlinks (restore original files)
dotstate deactivate
# Show the current profile
dotstate profile
# List all profiles
dotstate profile list
# Switch to another profile
dotstate profile switch work
# Package management
dotstate packages list # List packages with status
dotstate packages add -n ripgrep -m brew -b rg # Add a package
dotstate packages check # Check what's installed
dotstate packages install # Install missing packages
# Check for updates and upgrade
dotstate upgrade
# Show help
dotstate help
Using DotState with AI agents
DotState ships a built-in agent skill that teaches coding agents (Claude Code and others) its concepts and commands:
# Print the skill (SKILL.md) to stdout
dotstate --skill
# Install it globally for Claude Code (~/.claude/skills/dotstate/SKILL.md)
dotstate --skill --install
The skill is embedded in the binary, so re-run --install after upgrading to pick up changes. add and remove accept --yes to skip the confirmation prompt in scripts.
Omarchy
On Omarchy, register DotState as a launcher app that opens in a centered floating window:
dotstate omarchy --install # launcher entry, icon, and floating window rule
dotstate omarchy --uninstall # remove them again
It works on Omarchy 3 (hyprland.conf) and Omarchy 4 (hyprland.lua). The window rule goes into a marked block in your Hyprland user config, so re-running is safe and uninstall leaves the file as it was.
Shell Completions
Generate completions for your shell:
# Bash
source <(dotstate completions bash)
# Fish
dotstate completions fish | source
# Zsh
source <(dotstate completions zsh)
Using oh-my-zsh, antigen, or prezto? These frameworks require the fpath approach:
Then add fpath=(~/.zsh/completions $fpath) to your .zshrc before your framework loads.
How It Works
Storage: Your dotfiles are stored in a Git repository (default: ~/.config/dotstate/storage)
Symlinks: Original files are replaced with symlinks pointing to the repo
Profiles: Different profiles can have different sets of files
Inheritance: Profiles can inherit from a parent — child files override parent files, common files have the lowest priority
Common Files: Files that are shared across all profiles are stored in the common section and linked regardless of the active profile
Sync: Changes are committed and synced with GitHub automatically
Working with Profiles
Profiles are how DotState organizes your dotfiles for different machines or contexts. Each profile has its own set of files, while Common Files are shared across all profiles automatically.
In the TUI, go to Manage Profiles and press C to create a new profile. You can:
Start blank for a completely new setup
Inherit from an existing profile to create a live link — the child automatically gets all parent files and packages, and you only override what’s different
Copy from an existing profile to carry over files and packages as a one-time snapshot — great for setting up a similar machine quickly
Inherit vs Copy: Inheritance is a live relationship — changes to the parent are reflected in the child. Copy is a one-time fork — after creation, the two profiles are independent.
Profile Inheritance
A profile can inherit from one parent. When activated, DotState resolves files from the full chain:
In this example, work-laptop gets: its own .ssh/config, work’s .zshrc, and base’s .vimrc and .tmux.conf.
Cycles are detected and rejected. Profiles that are inherited by others cannot be deleted until the inheritance is removed.
Switching Profiles
Select a profile and press Enter to switch. DotState will remove symlinks for the old profile and create symlinks for the new one automatically (including inherited files). Common files stay linked regardless of which profile is active. If activation fails, the old profile is automatically restored.
Common Files
You decide which files are shared. Move any file to Common and it will be symlinked in every profile. Common files stay linked when you switch profiles. To move a file between profile-specific and common:
Go to Manage Files
Select a file
Press M to move it to Common (or back to the active profile)
Use Cases
Multi-machine: Use a Personal profile on your laptop, Work on your work machine, and Server for headless setups. Keep shared configs (.gitconfig, .tmux.conf) in Common.
Same computer, different contexts: Create profiles like day, night, or focus with different terminal themes and defaults, and switch between them instantly.
Layered configs with inheritance: Create a base profile with your core setup, then have work and personal inherit from it — each only overrides what’s different (like .zshrc or .ssh/config). Changes to base automatically flow to all children.
Quick duplication: When setting up a second machine, create a new profile by copying from an existing one, then tweak what’s different.
Configuration
Repository Setup Modes
DotState supports two repository setup modes:
GitHub Mode (Automatic)
Let DotState create and manage a GitHub repository for you. Requires a GitHub Personal Access Token.
GitHub Token Options:
DotState supports both Classic tokens and Fine-grained tokens (recommended).
Required scope:repo (Full control of private repositories)
Token Configuration:
Environment Variable (Recommended for automation):
export DOTSTATE_GITHUB_TOKEN=ghp_your_token_here
# or for fine-grained tokens:
export DOTSTATE_GITHUB_TOKEN=github_pat_your_token_here
The environment variable takes precedence over the config file token.
Config File: The token can be stored in the config file (set during first-time setup).
Local Mode (Bring Your Own Repo)
Use any existing git repository from any host (GitHub, GitLab, Bitbucket, self-hosted, etc.).
Setup:
Create a repository on your preferred git host
Clone it locally: git clone <url> ~/.config/dotstate/storage
Ensure you can push: git push origin main
In DotState, choose “Use my own repository” and enter the path
Benefits of Local Mode:
Works with any git host
Uses your existing SSH keys or git credentials
No GitHub token required
Update Notifications
DotState automatically checks for updates and shows a notification in the main menu when a new version is available. You can also check manually:
# Check for updates interactively
dotstate upgrade
# Just check without prompting
dotstate upgrade --check
Configuration:
Update checks can be configured in ~/.config/dotstate/config.toml:
[updates]
check_enabled = true # Set to false to disable update checks
check_interval_hours = 24 # How often to check (default: 24 hours)
Theme Configuration
DotState supports both light and dark themes that automatically adapt to your terminal background. The theme affects all UI elements including colors, borders, text, and syntax highlighting in file previews.
Changing the Theme:
Edit ~/.config/dotstate/config.toml and set the theme option:
theme = "dark" # Default dark theme
theme = "light" # For light terminal backgrounds
theme = "midnight" # Deep dark blue theme
theme = "solarized-dark" # Solarized Dark
theme = "solarized-light" # Solarized Light
theme = "gruvbox-dark" # Gruvbox Dark (warm, retro)
theme = "gruvbox-light" # Gruvbox Light
theme = "catppuccin-mocha" # Catppuccin Mocha (pastel dark)
theme = "catppuccin-latte" # Catppuccin Latte (pastel light)
theme = "tokyonight-dark" # Tokyo Night (city-lights dark)
theme = "tokyonight-light" # Tokyo Night Light
theme = "nocolor" # Disable all UI colors (same as NO_COLOR=1 / --no-colors)
Status colors (success, warning, error indicators)
Keymap Configuration
DotState supports customizable keyboard shortcuts with preset keymaps (Standard, Vim, Emacs) and custom key binding overrides. The keymap system allows you to use your preferred keyboard layout and override any action with any key combination.
Available Presets:
Standard: Arrow keys (↑↓), Enter, Esc, standard navigation
Vim: Vim-style navigation (hjkl for movement, q to quit, etc.)
Emacs: Emacs-style navigation (Ctrl+N/P for up/down, Ctrl+G to quit, etc.)
Changing the Preset:
Edit ~/.config/dotstate/config.toml and set the preset option in the [keymap] section:
Backup System: Automatic backups before any file operation
Token Security: GitHub tokens can be provided via DOTSTATE_GITHUB_TOKEN environment variable (recommended) or stored in config files with secure permissions
Requirements
Rust: Latest stable version (for building from source)
Git: For repository operations
Git Account: GitHub, GitLab, Bitbucket, or any git host (optional, for cloud sync)
(Recommended) Nerd Fonts: For the best visual experience, we recommend using a Nerd Font to see all icons correctly.
Project Status
DotState is actively developed and ready for use. The core features are stable, and we’re continuously improving based on user feedback.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
评论