Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bin/omarchy-menu
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ show_toggle_menu() {
}

show_setup_menu() {
local options=" Audio\n Wifi\nσ°‚― Bluetooth\n󱐋 Power Profile\n󰍹 Monitors"
local options=" Audio\nο€½ Video\n Wifi\nσ°‚― Bluetooth\n󱐋 Power Profile\n󰍹 Monitors"
[ -f ~/.config/hypr/bindings.conf ] && options="$options\nο„œ Keybindings"
[ -f ~/.config/hypr/input.conf ] && options="$options\nξΎΊ Input"
options="$options\nσ°±” DNS\nξ˜• Config\n󰈷 Fingerprint\n Fido2"

case $(menu "Setup" "$options") in
*Audio*) alacritty --class=Wiremix -e wiremix ;;
*Video*) show_setup_video_menu ;;
*Wifi*)
rfkill unblock wifi
alacritty --class=Impala -e impala
Expand Down Expand Up @@ -169,6 +170,13 @@ show_setup_power_menu() {
fi
}

show_setup_video_menu() {
case $(menu "Video Setup" "ξœ‘ Studio Webcam") in
*Webcam*) present_terminal omarchy-setup-apple-studio-display-webcam ;;
*) show_setup_menu ;;
esac
}

show_setup_config_menu() {
case $(menu "Setup" " Hyprland\n Hypridle\n Hyprlock\n Hyprsunset\n Swayosd\n󰌧 Walker\n󰍜 Waybar\nσ°ž… XCompose") in
*Hyprland*) edit_in_nvim ~/.config/hypr/hyprland.conf ;;
Expand Down
111 changes: 111 additions & 0 deletions bin/omarchy-setup-apple-studio-display-webcam
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/usr/bin/env bash

# ---- Apple Studio Display Webcam Setup for Omarchy ----
#
# SIMPLE THUNDERBOLT-ONLY SETUP - NO SPECIAL CABLES REQUIRED!
#
# This script works straight out of the box with ONLY the Apple Studio Display's
# included Thunderbolt cable. No DisplayPort + USB-A => USB-C adapter needed!
#
# βœ… TESTED ON: Framework Laptop 13 with AMD 7040 Series
# βœ… WORKS WITH: Single Thunderbolt 3/4 cable (included with Studio Display)
# βœ… ACTIVATES: 1080p webcam + studio-quality audio + display
#
# Acknowledgements:
# Constructed using contributions from @mikeytag on community.frame.work
# https://community.frame.work/t/apple-studio-display-any-experiences/34702/14

# ---- First, ensure bolt is installed for thunderbolt control ----
if ! command -v bolt &>/dev/null; then
echo "Installing bolt for Thunderbolt device management..."
yay -S bolt --noconfirm
else
echo "βœ“ bolt is already installed"
fi

# ---- Second, switch audio to Studio Display when docked, or to laptop when undocked ----

# Check if Studio Display audio devices are available
STUDIO_SINK=$(pactl list short sinks | grep "Studio_Display" | head -1 | cut -f2)

if [[ -n "$STUDIO_SINK" ]]; then
echo "Studio Display detected, switching audio output..."
pactl set-default-sink "$STUDIO_SINK"

# Also switch the microphone to Studio Display
STUDIO_SOURCE=$(pactl list short sources | grep "Studio_Display" | grep -v "monitor" | head -1 | cut -f2)
if [[ -n "$STUDIO_SOURCE" ]]; then
pactl set-default-source "$STUDIO_SOURCE"
echo "Switched to Studio Display microphone"
fi

echo "Audio switched to Studio Display"
else
echo "Studio Display not detected, switching to laptop audio..."
# Switch to laptop speakers
LAPTOP_SINK=$(pactl list short sinks | grep "pci-0000_c1_00.6" | cut -f2)
if [[ -n "$LAPTOP_SINK" ]]; then
pactl set-default-sink "$LAPTOP_SINK"
fi

# Switch to laptop microphone
LAPTOP_SOURCE=$(pactl list short sources | grep "pci-0000_c1_00.6" | grep -v "monitor" | cut -f2)
if [[ -n "$LAPTOP_SOURCE" ]]; then
pactl set-default-source "$LAPTOP_SOURCE"
fi

echo "Audio switched to laptop"
fi

# ---- Main Feature: Configure Apple Studio Display webcam for optimal 1080p quality ----

echo "ξœ‘ Configuring Apple Studio Display webcam for optimal quality..."
echo " This activates the Studio Display's built-in 12MP Ultra Wide camera"
echo " at 1080p resolution with auto-exposure and white balance."

# Find all Studio Display webcams
STUDIO_CAMS=$(v4l2-ctl --list-devices | grep -A1 "Studio Display" | grep "/dev/video" | head -2)

for cam in $STUDIO_CAMS; do
if [[ -e "$cam" ]]; then
echo "Configuring $cam..."

# Set to 1080p 30fps MJPEG for best quality
v4l2-ctl -d "$cam" --set-fmt-video=width=1920,height=1080,pixelformat=MJPG 2>/dev/null

# Set exposure and white balance to auto
v4l2-ctl -d "$cam" --set-ctrl=auto_exposure=0 2>/dev/null # Auto Mode
v4l2-ctl -d "$cam" --set-ctrl=white_balance_automatic=1 2>/dev/null

# Set power line frequency to 60Hz (US standard)
v4l2-ctl -d "$cam" --set-ctrl=power_line_frequency=2 2>/dev/null

# Center the camera (reset pan/tilt)
v4l2-ctl -d "$cam" --set-ctrl=pan_absolute=0 2>/dev/null
v4l2-ctl -d "$cam" --set-ctrl=tilt_absolute=-2880000 2>/dev/null # Default tilt

# Set zoom to a natural level (slightly zoomed in from minimum)
v4l2-ctl -d "$cam" --set-ctrl=zoom_absolute=150 2>/dev/null

echo " Set to 1920x1080 30fps MJPEG"
fi
done

echo "βœ… Studio Display webcam configuration complete!"
echo ""
echo "󱁖 Your Apple Studio Display is now optimized for:"
echo " β€’ 1920x1080 resolution at 30fps"
echo " β€’ MJPEG format for best quality"
echo " β€’ Auto-exposure and white balance"
echo " β€’ Centered position with natural zoom level"
echo ""
echo "πŸ’‘ Works with any video conferencing app (Zoom, Teams, Meet, etc.)"
echo ""
echo "Current webcam settings:"
for cam in $STUDIO_CAMS; do
if [[ -e "$cam" ]]; then
echo "$cam:"
v4l2-ctl -d "$cam" --get-fmt-video | grep -E "Width|Pixel"
echo ""
fi
done