CodeGate is an innovative Linux productivity tool that blocks your distracting applications and forces you to solve a coding challenge to access them.
π― Goal: Improve your personal discipline while boosting your programming skills.
- Continuous monitoring of configured applications
- Instant blocking via
SIGSTOP(without killing the app) - Fast detection (0.3s) to intercept launches
- Anti-bypass protection with watchdog
- Various algorithmic problems
- Multi-language support: Python β’ JavaScript β’ PHP
- Difficulty levels: Easy, Medium, Hard, Mixed
- 200+ built-in challenges
- Editor with syntax highlighting
- Watchdog: Automatically restarts if CodeGate is closed
- Config protection: Detects modifications using SHA256 checksums
- Auto-start: Activates on each login
- Detailed logs: Automatic rotation (5MB)
- Daily and total blocks
- Challenges solved/failed
- Success rate
- Full history
- PySide6 graphical interface
- Welcome wizard for initial setup
- App selection with categories
- System notifications
- Real-time search
- OS: Linux (tested on Ubuntu/Debian)
- Python: 3.10+
- Node.js: For JavaScript challenges (v14+ recommended)
- PHP: For PHP challenges (v7.4+ recommended)
- Environment: Desktop with window manager
βΉοΈ Note: The installation script can automatically install Node.js and PHP if theyβre missing. You can also use only Python if you prefer.
# Clone the repository
git clone https://github.com/mouwaficbdr/codegate.git
cd codegate
# Run the installer
./install.shThe script will:
- β Check Python 3.10+
- β Create a virtual environment
- β Install dependencies
- β Configure auto-start
- β Create required folders
# 1. Create the virtual environment
python3 -m venv venv
source venv/bin/activate
# 2. Install dependencies
pip install -r requirements.txt
# 3. Copy the autostart file
mkdir -p ~/.config/autostart
cp codegate.desktop ~/.config/autostart/
# 4. Edit the path in codegate.desktop
nano ~/.config/autostart/codegate.desktop
# Replace /home/mouwaficbdr/Code/codegate with your pathOn first start, a configuration wizard guides you:
- Welcome: Introduction to the concept
- App selection: Choose apps to block
- Difficulty: Challenge difficulty
- Summary: Review and validate
CodeGate runs in the background and can be controlled in multiple ways:
# Open the dashboard
codegate open
# Check if CodeGate is running
codegate status
# Quit CodeGate
codegate quitLook for the π‘οΈ CodeGate icon in your system tray (usually near the clock):
- Click to open the menu
- Select Settings to configure apps
- Select Quit to stop CodeGate
-
CodeGate starts automatically at login
-
Configured apps are monitored
-
If you launch a blocked app:
- βΈοΈ The app is paused (SIGSTOP)
- π A full-screen challenge appears
- π» Solve the challenge
- β The app unlocks upon success
| Command | Action |
|---|---|
codegate open |
Open the dashboard window |
codegate config |
Alias for open |
codegate dashboard |
Alias for open |
codegate status |
Check if CodeGate is running |
codegate quit |
Stop CodeGate daemon |
codegate help |
Show help |
Access settings via:
- CLI:
codegate open - Tray Icon: Click the βοΈ icon
You can:
- Modify blocked applications
- Change difficulty
- Add custom apps
- View statistics
codegate/
βββ src/
β βββ main.py # Main entry point
β βββ main_gui.py # Challenge overlay interface
β βββ dashboard.py # Dashboard window (settings)
β βββ ipc_server.py # CLI communication server
β βββ watchdog.py # Anti-kill protection
β βββ process_blocker.py # Process blocking
β βββ process_monitor.py # Advanced detection
β βββ config_protector.py # Config protection
β βββ code_runner.py # User code execution
β βββ challenge_fetcher.py # Challenge retrieval
β βββ notification_manager.py # System notifications
β βββ tray_icon.py # System tray icon
β βββ logger.py # Centralized logs
β βββ onboarding.py # First-use wizard
β βββ i18n_manager.py # Internationalization
βββ bin/
β βββ codegate # CLI script
βββ assets/
β βββ challenges.json # Database of 200+ challenges
β βββ codegate_icon.svg # App icon
βββ install.sh # Installation script
βββ uninstall.sh # Uninstallation script
βββ run_codegate.sh # Watchdog launcher
βββ codegate.desktop # Autostart file
βββ config.json # User configuration
{
"blocked_apps": ["discord", "firefox", "steam"],
"custom_apps": ["my-app"],
"language": "fr",
"difficulty_mode": "Mixed",
"first_run": false
}Location: ~/.local/share/codegate/logs/
codegate.log: Main logs (5MB rotation)errors.log: Errors onlywatchdog.log: Watchdog logs
File: ~/.local/share/codegate/stats.json
Q: Does CodeGate work offline? A: Yes! All challenges are stored locally.
Q: Can I temporarily disable CodeGate?
A: Yes, use codegate quit or click "Quit" in the system tray. The watchdog will NOT restart it automatically when quit properly.
Q: How to fully uninstall it?
A: Run ./uninstall.sh, which cleans everything.
Q: Can I add my own challenges?
A: Yes, edit assets/challenges.json (see structure).
Q: Does CodeGate require sudo? A: No for usage. Optional for system-level installation.
# Check logs
cat ~/.local/share/codegate/logs/codegate.log
# Test manually
./run_codegate.sh- Check if the app is in the list
- Check the process name:
ps aux | grep appname - Check logs for errors
# Recreate venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtFor more help, see docs/TROUBLESHOOTING.md.
Contributions are welcome!
- Fork the project
- Create a branch (
git checkout -b feature/AmazingFeature) - Commit (
git commit -m 'Add AmazingFeature') - Push (
git push origin feature/AmazingFeature) - Open a Pull Request
MIT License β See the LICENSE file for details.
Made with β€οΈ for focused devs




