Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Using Your Monitor as a Key Light with Bash and a Wallpaper Tool

using-your-monitor-as-a-key-light-with-bash-and-a-wallpaper-tool.jpg

This is handy for when you're on video with a webcam and want to control the lighting on your face in a quick way.

Quick Jump:

Prefer video? Here it is on YouTube.

I record a lot of YouTube videos. When I used Windows I used to record a 1080p section of my screen on a 4k monitor and then fill the areas outside of the recording zone with a few white background notepads to make things brighter. It worked nicely.

You’ll notice my face looks a bit darker on Linux because I’ve been recording my entire desktop instead. That’s because my wallpaper and terminal are mostly dark.

Since I have 2 monitors I used to open Firefox with an empty tab that has a white background on the 2nd monitor to at least brighten half my face a little bit. Despite having a pretty strong LED light that I turn on, my main monitor’s 32" display with a dark background still overtakes it, but every bit of lightness helps.

Still, for podcasts or video chats with friends I can brighten up my face by temporarily using a light background color controlled by a script so it’s easy to toggle. This is a super light weight solution that re-uses how you set wallpapers.

# The Script

It’s a small shell script. It’s wired up to use swaybg since that’s what I use for setting wallpapers but you can adjust that command to use whatever you use instead.

If you’re using DotFriedRice, you already have access to the keylight script!

You’ll be able to run things like:

# Light up all monitors with a default background color of #ffffff (white).
keylight

# Light up a specific monitor.
keylight --output HDMI-A-2

# Light up a specific monitor using a custom color (green), make sure to pass
# in the --output before --color (this is how swaybg works).
keylight --output HDMI-A-2 --color "#00ff00"

With niri you can find your outputs with niri msg outputs.

The way I’ve programmed it is if you run the command it will turn on the key light, if you run it again with the same color it will turn it off so you can easily toggle it. If you run it with different colors, the latest color will overwrite the previous one.

The video below goes over both using the script and how it’s implemented.

# Demo Video

Timestamps

  • 0:18 – Demonstrating the key light
  • 1:11 – Why my face was brighter on Windows vs Linux
  • 1:52 – Toggling and overwriting colors
  • 2:54 – Going over the key light script
  • 3:30 – Parsing args
  • 4:44 – Managing a state file

Do you think you’ll be using this? Let me know below.

Never Miss a Tip, Trick or Tutorial

Like you, I'm super protective of my inbox, so don't worry about getting spammed. You can expect a few emails per year (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.



Comments