crontab, it's enough to :
- kill any add during specific period
- accumulate usage per app
- check if tabs are opened
and it's pretty straighforward to configure, e.g.
* 8-17 * * 1-5 killall SlayTheSpire && date >> ~/shame
# prevents from playing during weekday working hours
or for accumulation (which can be reset daily, weekly, etc by simply deleting the minutes file)
pgrep mpv && >> mpv_minutes; if [ $(wc -l mpv_minutes) -gt 1000 ]; then echo beyond threshold; fi
That works also for turning up/down network interfaces.
PS: I use this on myself. I'm not a child but I don't have perfect self control. It works.
Perfect, I might even set my UA for reddit to mobile then, I need an "excuse" to keep on using it less. I still browse it without an account but I should lose the habit.