Coding and watching a series on one screen

Published on 2024-06-02 by xarkes

Unfortunately, things don't always go as planned. I started this sci-fi TV show, and couldn't help but prefer watching it over doing some more productive things. The good thing is that although the content of the show is getting less interesting and slower, I started feeling like I was spending 50 minutes watching episodes only to get 10 minutes of actual content, ending up on a cliffhanger and willing to jump into the next one.

I immediately thought I could code while watching the TV show, however my current situation involves only my laptop screen so it's tough to multitask. So what about showing my code on top of the video?

My current setup for coding is the following:

So let's give it a try, and set alacritty's background opacity down:

# ~/.config/alacritty/alacritty.toml
[window]
opacity = 0

In order for this to take effect, a compositor is required. I don't usually have one running with Awesome WM, however any would do, for instance picom. Its default configuration should make the opacity configuration work.

Let's create a new Helix theme such that it has no background color, to use the terminal's background and be transparent too.

mkdir -p ~/.config/helix/themes
cat >> ~/.config/helix/themes/translucid.toml <<EOF
inherits = "dracula"
"ui.background" = {}
EOF

The theme can now be loaded in Helix, and the background will be transparent. However, one issue remains: the text is still opaque.

I wonder if this is the best way, but I could easily change Alacritty's whole opacity using picom configuration.

# ~/.config/picom/picom.conf
# [...]

# Make Alacritty windows opacity to 20%
opacity-rule = [ "20:class_g = 'Alacritty'" ];

Result

That's it, I now have a perfectly transparent window on top of my video, with translucid text! It's not perfect as obviously the theme colors are fixed while the video image changes (eg. from black to white), but it's quite cool to be able to watch a video while writing code. Quite uncommon setup, but I find it quite cool, although I really believe multitasking doesn't help focusing and being actually efficient. But hey, it's Sunday, who cares about efficiency anyways?

A transparent terminal and text editor on top of a video