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
- ๐ฅ๏ธ Cross-platform (Windows, macOS, Linux)
- ๐งช Dry-run mode to preview changes
Installation
From Releases (Recommended)
Download the latest release from the Releases page:
- Windows:
focusmode-windows-amd64.zip
Extract the archive and run focusmode-windows-amd64.exe.
With wget
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.
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:
winget install ChenYuan.FocusMode
See Winget Submission for submission notes.
From Source
- Make sure you have Go installed (1.21 or later)
- Install dependencies:
go mod tidy
- Build the project:
go build -o focusmode .
Configuration
Profile Configuration (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 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.
Usage
Basic usage (uses default mode)
./focusmode
Use a specific mode
./focusmode -mode focusmode
./focusmode -mode gamemode
List available modes
./focusmode -list-modes
List desktop files
./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.
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
- Provides a summary of moved files
Example
If you have shortcuts on your desktop:
Chrome.lnk
VS Code.lnk
Steam.lnk
Epic Games.lnk
And 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:
- Create
~/FocusMode_Shortcuts folder
- Move
Chrome.lnk and VS Code.lnk to that folder
- Leave game shortcuts on the desktop
Running ./focusmode -mode gamemode will:
- Create
~/GameMode_Shortcuts folder
- Move
Steam.lnk and Epic Games.lnk to that folder
- Leave work shortcuts on the desktop
Releases
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 .
License
MIT