FocusGate is a productivity-boosting Chrome extension designed to gamify your LeetCode practice. It keeps you focused by blocking distracting websites and unlocks them only after you solve a set target of LeetCode questions.
- Smart LeetCode Integration: Automatically detects when you get an
Acceptedsubmission on LeetCode problems in real-time. - Focus Restrictor: Blocks popular distracting websites (like Instagram, Reddit, Amazon, etc.) using Chrome's
declarativeNetRequestAPI during active focus sessions. - Reward Mechanism: Earn custom reward/break times. Once you complete your target questions, access to blocked websites is unlocked for your specified duration.
- Visual Progress Tracking: Track your focus status, active target, and reward time remaining with a progress bar directly in the extension popup.
- Blocklist Management: Manage domains you want to avoid during focus sessions.
Since FocusGate is currently in development, you can load it directly into Google Chrome as an unpacked extension:
-
Download the Extension: Clone or download this repository to your local machine.
-
Open Chrome Extensions Page: Open Google Chrome and navigate to
chrome://extensions/by typing it in the address bar. -
Enable Developer Mode: In the top-right corner of the Extensions page, toggle the Developer mode switch to ON.
-
Load the Extension:
- Click the Load unpacked button in the top-left corner.
- Select the folder containing this extension (the folder with the
manifest.jsonfile, e.g.,tutorial.hello-world).
-
Pin the Extension (Recommended): Click the puzzle piece icon (Extensions menu) in the Chrome toolbar next to your profile picture, find FocusGate, and click the pin icon for quick access.
- Click the FocusGate icon in your toolbar.
- In the Session tab, enter your:
- Target Questions: The number of unique LeetCode problems you must solve to unlock your reward (e.g.,
3). - Reward Duration: The duration in minutes you will be allowed to browse blocked websites after finishing your task (e.g.,
30).
- Target Questions: The number of unique LeetCode problems you must solve to unlock your reward (e.g.,
- Click Start Focus Session. The extension status will change to Active, and the background blocker will begin blocking access to restricted domains.
- Open any problem page on LeetCode.
- Submit your solution.
- Once the submission result is detected as Accepted, FocusGate registers it as solved and updates your session progress. (Note: The extension remembers problems solved during the session to avoid duplicate counting of the same problem).
- Once the progress bar reaches 100% (e.g., 3/3 solved), the status changes to Unlocked.
- The blocklist is disabled, allowing you to access blocked sites.
- A countdown timer in the popup will display the remaining time of your reward.
- Automatic Re-lock: Once the countdown reaches
00:00, the extension automatically locks access to the blocklist again and starts a new focus session.
- Navigate to the Blocklist tab in the extension popup.
- Type a domain (e.g.,
facebook.com) and click Add to include it. - You can remove domains from the list by clicking Delete next to them.
manifest.json- Configuration and permissions settings for the Chrome Extension (MV3).focus.html- The popup interface layout.popup.js- Script handling UI interactions, tab switching, and local storage updates for the popup.background.js- Background service worker handling dynamic rulesets, alarms, and blocking logic.content.js- Content script that runs on LeetCode problem pages to detect successful submissions.hello_extensions.png- The logo icon for FocusGate.