Do you know this meme?

Overstimulation in the cinema
Overstimulation in the cinema
Well, that is sometimes me. Or maybe rather usual me.

The problem

I don’t know if it’s ADHD or my brain is fried from short form content, but I like having something just playing in the background. In my family household there was always radio playing or TV turned on. I don’t listen to much radio anymore (although I sometimes put on some Japanese radio station using awesome Radiola app), but I like to have a video or stream playing in the background — especially if I’m having trouble focusing on the task (which probably sounds insane, but it usually helps me to get into the zone).

Sadly with only two monitors you either sacrifice one screen completely or you put the video in some random window. But even with Brave screen splitting option — that doesn’t really work out for me.

My two monitor setup with Brave in split mode on main screen
My two monitor setup with Brave in split mode on main screen

I’m a huge fan of spaces on macOS and I always use apps fullscreen. I switch back and forth between them using touchpad. I could put the video on one of the spaces but that would mean I would have to move back and forth to glance at it — which will be far more distracting than it should be. I want the video to be constantly visible in a small window somewhere1 — that way I can achieve my own ADHD version of the Ballmer Peak.

The solution

MacOS has a built-in support for videos in Picture-in-picture mode, although it’s scarcely described. Well, let’s try it in Brave. Go to YouTube, right-click to a video and you will see this menu.

YouTube right-click menu, That ‘Stats for nerds’ button is calling me
YouTube right-click menu, That ‘Stats for nerds’ button is calling me
As you can see there is no Picture-in-picture (PiP) anywhere here. Now hold on, bear with me… right-click again.
Proper right-click menu
Proper right-click menu
Ta-da! There it is: the PiP option. Let’s click it and see the result.
Showing Linus Tech Tips video on top of Kagi search, almost seems like an ad
Showing Linus Tech Tips video on top of Kagi search, almost seems like an ad
Okay, we can see it works, now let’s switch to another space.
GarageBand, since I started playing guitar
GarageBand, since I started playing guitar
The small window with a video is now gone. Turns out PiP in Brave works only for other Brave windows/tabs. As soon as you switch to something different it will disappear.

But it probably doesn’t use native macOS PiP at all — the video window was way too square for macOS which is all about those rounded corners.

What will use native macOS PiP though? Well, macOS native web browser of course — Safari. Open Safari, right-click twice on a YouTube video and turn on Picture-in-picture again.

You could probably open another video and watch two at once
You could probably open another video and watch two at once
Works beautifully. Well, at least if you are fine with floating window only snapping to the screen corners, you cannot put it anywhere on the screen. Also the video pops in when you switch spaces but it’s good enough.

Twitch

So about that double right-click trick from YouTube… It doesn’t work on Twitch. Turns out there is an invisible HTML element over a video so you cannot actually click on the video file itself, what a bummer… But it turns out someone had the same issue and posted about it on Reddit.

With this little code snippet pasted into Browser developer tools console we can move that invisible html element out of our way.2

$("[playsinline]").style ="position:relative; z-index:99999";

That worked, but now I cannot use control buttons for pausing, changing resolution etc. Seems that invisible HTML element was kinda needed… Thankfully page refresh brings it all back.

A better way

By complete accident, I discovered one day that pressing Shift-Command-R on Safari doesn’t refresh the page without cache (as it does on every other browser I know). That shortcut actually enables Reader mode — the mode you normally use on web articles to get rid of all the fluff and ads, which is pretty neat, as it allows for focused reading — you know, the thing we actually don’t promote on this page.

Reader mode my beloved
Reader mode my beloved
Turns out, when you focus on a video window and press Shift-Command-R it makes the video pop out of the screen like shown below.
Watching my favorite streamer twitch.tv/joshimuz
Watching my favorite streamer twitch.tv/joshimuz
This actually enables PiP right away, if you switch to another space the window will pop-in in a corner! Only issue is that going back to original Safari space will put the video back in place — which is kinda annoying… so my recommended workflow is to:

  1. Open Twitch
  2. Click on the video once to make it in focus
  3. Press Shift-Command-R on your keyboard
  4. Right-click the popped out video
  5. Choose Enter Picture in Picture mode
  6. Minimize whole Safari window
  7. Use any other browser for actual work

The result - playing video floating in the corner on all spaces
The result - playing video floating in the corner on all spaces

PiP for productive stuff?

For some time I was trying to force a PiP-like behaviour for productivity. Sometimes I need to remember about something and if that something is on some other space… well, there is a risk I will forget about it. Even worse if that something is in some Slack thread I keep switching from. I dug through different note apps, but none of them could use PiP or rather floating windows in such a way that a note would always be visible — no matter the space.

Then I found a solution. A paid screenshot app called Cleanshot X. Yes. I paid with my own money for an app that makes screenshots, even though macOS has built-in screenshot capabilities. Turns out that app has a ton of features, but the one I was most interested in was called Floating Screenshots. Now I could do a screenshot of anything — a message from a coworker, a task list, a server console output and just pop it in place anywhere. I don’t know if they used native macOS mechanisms or what, but that’s the only app that keeps the window floating over every space and window.

Screenshots floating on top of everything
Screenshots floating on top of everything
Remember post-it notes? Well, who needs them with a setup like this!


  1. You can also use an iPad as a second screen or… just use that iPad for videos, or any other tablet, or a smartphone. ↩︎

  2. Don’t ever mess with developer console if you don’t know what you are doing, especially on sites where you are logged in! ↩︎