FocusMode is a Windows tray and command-line utility designed to help users organize desktop shortcuts into focus and game modes, restore shortcuts, and track time spent in each mode.
Key Features:
Organizes desktop shortcuts into designated folders based on predefined modes (e.g., FocusMode for productivity, GameMode for gaming).
Supports YAML-based configuration for customizing which shortcuts are moved and where they are stored.
Includes a system tray icon for easy access to switch modes or restore shortcuts without opening the command line.
Tracks time spent in each mode, providing insights into productivity and usage patterns.
Audience & Benefit:
Ideal for anyone seeking to declutter their desktop and improve focus, whether working on professional tasks or gaming. By organizing shortcuts into dedicated modes, users can create a distraction-free workspace or an optimized gaming environment, leading to increased productivity and reduced visual clutter.
FocusMode can be installed via winget once its manifest is accepted into the Microsoft Winget repository.
README
FocusMode
A simple Go tool to help you focus by organizing desktop shortcuts. Move shortcuts from your cluttered desktop to an organized folder.
Features
๐ Move desktop shortcuts to an organized folder
โ๏ธ Configure shortcuts via YAML file
๐ฎ Multiple modes: FocusMode and GameMode (easily extensible)
๐ Support for moving all shortcuts or specific ones
See Distribution for install directory and pinned-version options.
Winget
Draft winget manifests are available in winget/manifests/c/ChenYuan/FocusMode/0.1.0/.
After they are accepted into microsoft/winget-pkgs, users can install with:
Edit profile.yml to configure which shortcuts to move for different modes:
modes:
focusmode:
destination: "FocusMode_Shortcuts" # Folder name in home directory
shortcuts:
- "MyShortcut.lnk"
- "AnotherShortcut.lnk"
move_all: false # Set to true to move ALL shortcuts
gamemode:
destination: "GameMode_Shortcuts"
shortcuts:
- "Steam.lnk"
- "Epic Games.lnk"
move_all: false
default_mode: "focusmode" # Default mode if not specified
Categories Configuration (categories.yml)
The categories.yml file defines keywords used to automatically categorize shortcuts when using -list-desktop. This helps identify which shortcuts are games, development tools, work applications, etc.
You can customize the keywords and categories to match your needs. The file structure:
categories:
game:
name: "Games"
icon: "๐ฎ"
keywords:
- "steam"
- "epic"
- "game"
# ... more keywords
development:
name: "Development Tools"
icon: "๐ป"
keywords:
- "code"
- "docker"
- "git"
# ... more keywords
work:
name: "Work/Productivity"
icon: "๐ผ"
keywords:
- "office"
- "word"
- "excel"
# ... more keywords
category_order:
- game
- development
- work
- other
Note: If categories.yml doesn't exist, the tool will use default categories. You can create your own to customize the categorization logic.
This command shows all files on your desktop, grouped by category, with suggested modes for each shortcut. This is helpful when configuring which shortcuts to move.
Auto-generate profile
./focusmode -auto-config
This command automatically generates profile.yml based on your desktop shortcuts:
Games โ focusmode (moved when focusing to remove distractions)
Work/Development tools โ gamemode (moved when gaming to remove work distractions)
Other โ focusmode (moved when focusing)
Logic:
FocusMode: Moves games away โ keeps work tools on desktop for quick access
GameMode: Moves work tools away โ keeps games on desktop for quick access
The generated profile can be reviewed and customized as needed.
Restore shortcuts to desktop
# Restore shortcuts from a specific mode
./focusmode -restore -mode focusmode
# Restore shortcuts from all modes
./focusmode -restore-all
# Preview what would be restored (dry-run)
./focusmode -restore -mode gamemode -dry-run
This command moves shortcuts back from organized folders to your desktop. Useful when you want to restore your desktop to its original state.
Switch modes
# Restore currently hidden shortcuts, then apply FocusMode
./focusmode -switch -mode focusmode
# Restore currently hidden shortcuts, then apply GameMode
./focusmode -switch -mode gamemode
# Preview a mode switch
./focusmode -switch -mode gamemode -dry-run
This is the easiest command to use from a taskbar shortcut because each shortcut can switch directly to one mode.
Run as a system tray app
./focusmode -tray
On Windows, this starts a persistent notification-area icon. Click the tray icon to switch modes, restore all shortcuts, or quit the tray app.
Use Report hours from the tray menu to view tracked FocusMode/GameMode time without opening a terminal.
View tracked mode hours
./focusmode -stats
FocusMode tracks active time in focusmode_stats.db, stored next to profile.yml. Switching into a mode starts that mode's timer; switching modes or restoring shortcuts stops the previous active timer and saves the elapsed time.
With custom config file
./focusmode -config myconfig.yml
When -config or -categories is not provided, FocusMode looks for the default files next to the resolved executable. This keeps Winget aliases, desktop shortcuts, and symlinks from depending on the current working directory. Explicit relative paths are still resolved from the directory where you run the command.
Dry-run (preview without moving)
./focusmode -mode gamemode -dry-run
Command-line options
-config: Path to configuration file (default: profile.yml)
-categories: Path to categories configuration file (default: categories.yml)
-mode: Mode to use (focusmode, gamemode, etc.) - uses default if not specified
-dry-run: Preview what would be moved/restored without actually moving files
-list-modes: List all available modes from configuration
-list-desktop: List all files on your desktop with suggested modes (useful for configuring shortcuts)
-auto-config: Auto-generate profile.yml based on desktop shortcuts and categories
-restore: Restore shortcuts from a specific mode's folder back to desktop
-restore-all: Restore shortcuts from all modes back to desktop
-switch: Restore all shortcuts, then apply the selected mode
-tray: Run as a Windows system tray app
-stats: Show tracked mode usage totals
-version: Show version information
How it works
Reads configuration from profile.yml next to the executable by default
Creates destination folder in your home directory (if it doesn't exist)
Moves specified shortcuts from desktop to the destination folder
Releases are automatically built and published when you push a tag matching v*.*.* (e.g., v1.0.0).
Creating a Release
Using Git tags (recommended):
git tag v1.0.0
git push origin v1.0.0
Using GitHub Actions:
Go to Actions โ Release workflow
Click "Run workflow"
Enter the version tag (e.g., v1.0.0)
The workflow will automatically:
Build binaries for all platforms (Windows, macOS, Linux - AMD64 and ARM64)
Create release archives (.tar.gz for Unix, .zip for Windows)
Generate checksums for verification
Create a GitHub release with all artifacts
Verifying Releases
Download the checksums.txt file and verify:
sha256sum -c checksums.txt
Development
Running Tests
# Run all tests
go test ./...
# Run tests with verbose output
go test -v ./...
# Run tests with coverage
go test -cover ./...
# Run a specific test
go test -v -run TestGetDesktopPath
The test suite includes:
โ Configuration loading and parsing
โ Mode configuration retrieval
โ Desktop path detection (cross-platform)
โ File moving operations
โ Desktop shortcut listing
โ Error handling and edge cases
Building Locally
# Build for current platform
go build -o focusmode .
# Build for specific platform
GOOS=linux GOARCH=amd64 go build -o focusmode-linux-amd64 .