Clean Workspace: Archive Web Browser Tabs
I love experimenting with productivity. One glitch I've found in my mind is I can easily get distracted by open tabs on my browser, especially if I'm trying to write or read something which I want to give my full attention to.
I've found that if I close all my tabs (similar idea to shrinking context size), I can focus better on the task at hand. However, I don't want to lose any interesting tabs so I don't easily quit my browsers. It's just the little extra of cognitive energy required to add more focus that doesn't get spent.
This is utility to fix this issue. It closes all your tabs (in both Safari & Chrome), sends them to todoist with a specified project and optionally a label, and outputs the list to the terminal (mostly for debugging). Only unique URLs are sent to Todoist, if you have a previous "archive task" with a URL archived it will not be archived again.
This utility has helped my mind and made it easy for me to find interesting things I've run into in the past. I've tied this into a 'first wake' hyper focus script to automatically run each morning when I first open my computer.
Installation
uv tool install clean-workspace
# Install with optional AI summarization support
uv tool install "clean-workspace[ai]"
TODOIST_API_KEYhas to exist in your shell environment for the tool to run. I recommend using direnv to do this. Add your todoist token to.envrcanddirenv allow .- Customize the url and domain blacklist
AI Summarization (Optional)
If installed with the [ai] extra, the tool can automatically generate a 3-7 word summary of your links if --tab-description is not provided.
Configuration is via environment variables:
CLEAN_WORKSPACE_AI_KEY: Your AI provider API key (e.g., Gemini, OpenAI, Anthropic).CLEAN_WORKSPACE_MODEL: The model to use (default:gemini:gemini-3-flash-preview). Supports any provider supported by pydantic-ai.
Usage
clean-workspace --help
Usage: clean-workspace [OPTIONS]
Options:
--blacklist-domains PATH
--blacklist-urls PATH
--tab-description TEXT Description for tab
--todoist-label TEXT label in todoist for all created tasks [default:
web-archive]
--todoist-project TEXT project in todoist for all created tasks
[default: Learning]
--help Show this message and exit.
Development
uv sync --all-extras
uv run clean-workspace
Regex Entries
You can use regex matches in both the url and domain blacklist files. For example, if you want to blacklist all Zoom domains, you can use the following:
echo "/.*zoom\.us/" >> ~/.config/clean-workspace/blacklist-domains.txt
A regex entry starts & ends with /, like sed.
Collecting Tab Description Via AppleScript
Here's a quick script you can use to collect a description of what you were working on via applescript:
dialogResult=$(
osascript <<EOT
set dialogResult to display dialog "What were you working on yesterday?" buttons {"OK"} default button "OK" giving up after 300 default answer ""
return text returned of dialogResult
EOT
)
Here's a full example of using this with hyper-focus.
Debugging
You can use ipython to interactively play with the todoist API:
from clean_workspace import _todoist_api_key
api = TodoistAPI(_todoist_api_key())
Inspiration
- https://gist.github.com/aleks-mariusz/cc27b21f2c5b91fbd285
- https://github.com/tominsam/shelf-python/blob/f357d9b147fa651034b71501edabf65f59d5befa/extractors/ComAppleSafari.py#L11
This project was created from iloveitaly/python-package-template
Metadata
Release files for clean-workspace 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clean_workspace-0.10.0.tar.gz | 10.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clean_workspace-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.0 kB
Release files / clean_workspace-0.10.0.tar.gz
| Download URL | clean_workspace-0.10.0.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20144cd78e1025a0d0ad643c000eda0dac58dd5056b97a7e60e6bdf8a2b51043
|
|
BLAKE2b-256 checksum How to use checksums |
66d6e6f935c41c17428e11eea2cd37d37b1e623f8b897fcb26f3d060fb0f3364
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / clean_workspace-0.10.0-py3-none-any.whl
| Download URL | clean_workspace-0.10.0-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b82ab71ecc22fe41311a1621ab9ca060a5702ab21628183b002268c2890096a4
|
|
BLAKE2b-256 checksum How to use checksums |
aea6a144645ed64d9055037d8dc74f223c30c81d05e6042f47dee246a3da1483
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|