This looks like a similar open feature request which is here
If you're up for a bit of hacking, this can be achieved today using Pi-hole's Groups and some scripting.
- In Groups create a new group called Focus
- In Domains create new blacklist rules for the social media and other websites to block access
- Edit these blacklist rules and change them to just the new Focus group (no longer in Default)
- In Clients find your computers and click Add and change their group so they are in both Default and Focus groups
If the Focus group is turned off you get all the normal blocking from Default but not the social media. If the Focus group is turned on you get the blocking in Default plus the extra blocking from Focus.
Test this manually to make sure it's working as intended.
Finally, you can schedule the turning on and off of the Focus group using cron. You have to know how crontab entries are formatted – this reference will help.
Open crontab for editing
crontab -e
Add in your lines, eg to turn on Focus (block social media) at 9am and turn it back off (enable social media) at midday every day of the week:
#Enable Focus:
0 9 * * * sudo sqlite3 /etc/pihole/gravity.db "update 'group' set 'enabled'=1 where name='Focus';"; /usr/local/bin/pihole restartdns reload-lists &>/dev/null
#Disable Focus:
0 12 * * * sudo sqlite3 /etc/pihole/gravity.db "update 'group' set 'enabled'=0 where name='Focus';"; /usr/local/bin/pihole restartdns reload-lists &>/dev/null
Save your edits and quit the editor. Now the Focus group will be turned on and off automatically according to the schedule you specified.