#!/usr/bin/env bash
set -euo pipefail
# Sets up the Fishtank camera grid like:
# | Living room | Kitchen | Laundry room |
# | Bedroom 1 | Bedroom 2 | Bedroom 3 | Bedroom 4 |
# | Garage | Hallway (downstairs) | Hallway (upstairs) |
# Double click to focus a view. Press M to toggle mute. Starts all of the feeds muted by default.
# Uses compressor to make the feeds more audible.
# Run this on a workspace that doesn't have anything else on it.
MPV_OPTS=("--mute" "--no-terminal" '--af=lavfi="acompressor=mode=upward"')
spawn_video_in_background() {
AREA="$1"
mpv "${MPV_OPTS[@]}" --x11-name="fishtank-$AREA" "https://d27j2syygqshcy.cloudfront.net/live/$AREA/chunks.m3u8" &
}
do_for_area() {
AREA="$1"
shift
i3-msg "[instance=fishtank-$AREA]" "$@"
}
# Living area
spawn_video_in_background living-room
spawn_video_in_background kitchen
spawn_video_in_background laundry-room
# Bedrooms
spawn_video_in_background bedroom-1
spawn_video_in_background bedroom-2
spawn_video_in_background bedroom-3
spawn_video_in_background bedroom-4
# Garage & Hallway
spawn_video_in_background garage
spawn_video_in_background hallway-upstairs
spawn_video_in_background hallway-downstairs
# Wait for videos to load in
sleep 6
# Stuff everything into a vertical layout
do_for_area living-room focus
i3-msg split vertical
i3-msg mark the-tank
do_for_area garage move window to mark the-tank
do_for_area bedroom-1 move window to mark the-tank
# Living room, kitchen and laundry room feeds at the top
do_for_area living-room focus
i3-msg split horizontal
i3-msg mark the-tank-living-area
do_for_area laundry-room move window to mark the-tank-living-area
do_for_area kitchen move window to mark the-tank-living-area
# Bedrooms in the middle
do_for_area bedroom-1 focus
i3-msg split horizontal
i3-msg mark the-tank-bedrooms
do_for_area bedroom-4 move window to mark the-tank-bedrooms
do_for_area bedroom-3 move window to mark the-tank-bedrooms
do_for_area bedroom-2 move window to mark the-tank-bedrooms
# Garage and hallway at the bottom
do_for_area garage focus
i3-msg split horizontal
i3-msg mark the-tank-misc
do_for_area hallway-upstairs move window to mark the-tank-misc
do_for_area hallway-downstairs move window to mark the-tank-misc
# vim: ts=2 sw=2 et