FocusMode Chen Yuan
winget install --id=ChenYuan.FocusMode -e FocusMode is a Windows tray and command-line utility for organizing desktop shortcuts into focus and game modes, restoring shortcuts, and tracking time spent in each mode.
winget install --id=ChenYuan.FocusMode -e FocusMode is a Windows tray and command-line utility for organizing desktop shortcuts into focus and game modes, restoring shortcuts, and tracking time spent in each mode.
A simple Go tool to help you focus by organizing desktop shortcuts. Move shortcuts from your cluttered desktop to an organized folder.
Download the latest release from the Releases page:
focusmode-windows-amd64.zipExtract the archive and run focusmode-windows-amd64.exe.
wget https://github.com/chenyuan99/FocusMode/releases/latest/download/focusmode-windows-amd64.zip -OutFile focusmode-windows-amd64.zip
Expand-Archive .\focusmode-windows-amd64.zip -DestinationPath .\FocusMode -Force
.\FocusMode\focusmode-windows-amd64.exe -tray
Or use the installer script:
wget https://raw.githubusercontent.com/chenyuan99/FocusMode/master/scripts/install.ps1 -OutFile install-focusmode.ps1
.\install-focusmode.ps1
See Distribution for install directory and pinned-version options.
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:
winget install ChenYuan.FocusMode
See Winget Submission for submission notes.
go mod tidy
go build -o focusmode .
profile.yml)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.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.
./focusmode
./focusmode -mode focusmode
./focusmode -mode gamemode
./focusmode -list-modes
./focusmode -list-desktop
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.
./focusmode -auto-config
This command automatically generates profile.yml based on your desktop shortcuts:
focusmode (moved when focusing to remove distractions)gamemode (moved when gaming to remove work distractions)focusmode (moved when focusing)Logic:
The generated profile can be reviewed and customized as needed.
# 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.
# 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.
./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.
./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.
./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.
./focusmode -mode gamemode -dry-run
-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 informationprofile.yml next to the executable by defaultIf you have shortcuts on your desktop:
Chrome.lnkVS Code.lnkSteam.lnkEpic Games.lnkAnd your profile.yml contains:
modes:
focusmode:
destination: "FocusMode_Shortcuts"
shortcuts:
- "Chrome.lnk"
- "VS Code.lnk"
move_all: false
gamemode:
destination: "GameMode_Shortcuts"
shortcuts:
- "Steam.lnk"
- "Epic Games.lnk"
move_all: false
default_mode: "focusmode"
Running ./focusmode -mode focusmode will:
~/FocusMode_Shortcuts folderChrome.lnk and VS Code.lnk to that folderRunning ./focusmode -mode gamemode will:
~/GameMode_Shortcuts folderSteam.lnk and Epic Games.lnk to that folderReleases are automatically built and published when you push a tag matching v*.*.* (e.g., v1.0.0).
Using Git tags (recommended):
git tag v1.0.0
git push origin v1.0.0
Using GitHub Actions:
v1.0.0)The workflow will automatically:
.tar.gz for Unix, .zip for Windows)Download the checksums.txt file and verify:
sha256sum -c checksums.txt
# 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:
# Build for current platform
go build -o focusmode .
# Build for specific platform
GOOS=linux GOARCH=amd64 go build -o focusmode-linux-amd64 .
MIT