Only offer webcam recording when available

This commit is contained in:
David Heinemeier Hansson
2026-07-23 16:33:12 -07:00
parent 7798ed34b1
commit 2d3d1e2a3c
4 changed files with 25 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# omarchy:summary=Check whether a webcam is available
v4l2-ctl --list-devices 2>/dev/null | grep -q '^[[:space:]]*/dev/video'
+1 -1
View File
@@ -54,7 +54,7 @@
"trigger.capture.screenrecord.no-audio": {"icon":"","label":"With no audio","action":"omarchy-capture-screenrecording"},
"trigger.capture.screenrecord.desktop-audio": {"icon":"","label":"With desktop audio","action":"omarchy-capture-screenrecording --with-desktop-audio"},
"trigger.capture.screenrecord.microphone": {"icon":"","label":"With desktop + microphone audio","action":"omarchy-capture-screenrecording --with-desktop-audio --with-microphone-audio"},
"trigger.capture.screenrecord.webcam": {"icon":"","label":"With desktop + microphone audio + webcam","action":"omarchy-capture-screenrecording-with-webcam"},
"trigger.capture.screenrecord.webcam": {"icon":"","label":"With desktop + microphone audio + webcam","when":"omarchy-hw-webcam","action":"omarchy-capture-screenrecording-with-webcam"},
"trigger.transcode": {"icon":"󰧸","label":"Transcode","action":"omarchy-transcode"},
"trigger.share": {"icon":"","label":"Share","aliases":["share"]},
"trigger.toggle": {"icon":"󰔎","label":"Toggle","aliases":["toggle","toggles"]},
+5
View File
@@ -161,6 +161,11 @@ assertEqual(
'omarchy-hw-laptop',
'menu only shows Mirror Display on laptops'
)
assertEqual(
defaultById['trigger.capture.screenrecord.webcam'].when,
'omarchy-hw-webcam',
'menu only shows webcam screen recording when a webcam is available'
)
assert(
/font\.family: row\.iconFont\.length > 0 \? row\.iconFont : root\.fontFamily/.test(menuQml),
'menu rows support per-icon font families'
+14
View File
@@ -13,6 +13,8 @@ mkdir -p "$stub_bin"
cat >"$stub_bin/v4l2-ctl" <<'SH'
#!/bin/bash
[[ ${OMARCHY_TEST_NO_WEBCAM:-false} == "true" ]] && exit 0
printf '%s\n' "Built-in Webcam: Integrated Camera"
printf '\t%s\n' "/dev/video0"
printf '\t%s\n' "/dev/video1"
@@ -47,6 +49,18 @@ export OMARCHY_TEST_MENU_ARGS="$tmp_dir/menu-args"
export OMARCHY_TEST_RECORDER_ARGS="$tmp_dir/recorder-args"
export OMARCHY_TEST_NOTIFICATION_ARGS="$tmp_dir/notification-args"
if "$ROOT/bin/omarchy-hw-webcam"; then
pass "webcam hardware detection succeeds when a video device is available"
else
fail "webcam hardware detection succeeds when a video device is available"
fi
if OMARCHY_TEST_NO_WEBCAM=true "$ROOT/bin/omarchy-hw-webcam"; then
fail "webcam hardware detection fails when no video device is available"
else
pass "webcam hardware detection fails when no video device is available"
fi
"$ROOT/bin/omarchy-capture-screenrecording-with-webcam"
expected_menu_args="$tmp_dir/expected-menu-args"