← back

22 Mar 2026

My first firefox extension

Personalize your software

I wouldn’t say I have an addictive personality, but I do spend too much time on YouTube. It’s a devious pattern where I watch educational content, learn a bunch of useless stuff and feel like I’m not wasting my time doing it. I don’t want to stop watching videos on YouTube entirely, there is some genuinely fantastic content on there. But I need to limit my time on it.

I’ve been aware of this pattern for years, but didn’t do anything about it. Then, I installed LeechBlock, a Firefox extension that allows you to set up block rules for certain websites. Like say, at most 30 minutes of YouTube per day and after that it will block further access. Depending on my mood, I would then habitually overrule the block. So it wasn’t exactly working.

Then, a couple of weeks ago I had an idea. What if I don’t just allow myself a maximum duration of YouTube per day that resets every day but instead keep a rolling balance that increases by X minutes every day and decreases by however much I use of it, effectively allowing a roll over of unused time? I postulated that this may help psychologically as not spending time on YouTube today is not a lost opportunity, but rather delayed gratification.

While LeechBlock has the option to roll over time, it doesn’t quite work the way I need it to. So I set out to build my own.

Starting out with a tutorial on MDN, I was surprised how easy it is to get a first demo extension built and installed. From there, I iterated with Claude to get the behaviour I needed. And boy did it take some prompting. While Claude understands the APIs available to an extension just fine, it struggled with concepts like timers not firing when the device is sleeping.

The result is this tiny extension. It keeps track of the remaining time budget and when it was last updated in local storage. Whenever YouTube is in focus, it updates the budget and the timestamp every second. When there is a visibility change, it checks when the budget was last updated and adds time as appropriate. I currently have it afford 2.5 minutes every hour, which comes to 1 hour of YouTube per day. You gotta start somewhere.

It’s worked well so far. As theorized, I have an easier time doing something else and not feeling like I’m missing out, as I’m just postponing watching that video where the guy explains how dishwashers work. I should build software that fits my needs exactly more often.