Only offer webcam recording when available
This commit is contained in:
Executable
+5
@@ -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'
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
"trigger.capture.screenrecord.no-audio": {"icon":"","label":"With no audio","action":"omarchy-capture-screenrecording"},
|
"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.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.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.transcode": {"icon":"","label":"Transcode","action":"omarchy-transcode"},
|
||||||
"trigger.share": {"icon":"","label":"Share","aliases":["share"]},
|
"trigger.share": {"icon":"","label":"Share","aliases":["share"]},
|
||||||
"trigger.toggle": {"icon":"","label":"Toggle","aliases":["toggle","toggles"]},
|
"trigger.toggle": {"icon":"","label":"Toggle","aliases":["toggle","toggles"]},
|
||||||
|
|||||||
@@ -161,6 +161,11 @@ assertEqual(
|
|||||||
'omarchy-hw-laptop',
|
'omarchy-hw-laptop',
|
||||||
'menu only shows Mirror Display on laptops'
|
'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(
|
assert(
|
||||||
/font\.family: row\.iconFont\.length > 0 \? row\.iconFont : root\.fontFamily/.test(menuQml),
|
/font\.family: row\.iconFont\.length > 0 \? row\.iconFont : root\.fontFamily/.test(menuQml),
|
||||||
'menu rows support per-icon font families'
|
'menu rows support per-icon font families'
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ mkdir -p "$stub_bin"
|
|||||||
cat >"$stub_bin/v4l2-ctl" <<'SH'
|
cat >"$stub_bin/v4l2-ctl" <<'SH'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
[[ ${OMARCHY_TEST_NO_WEBCAM:-false} == "true" ]] && exit 0
|
||||||
|
|
||||||
printf '%s\n' "Built-in Webcam: Integrated Camera"
|
printf '%s\n' "Built-in Webcam: Integrated Camera"
|
||||||
printf '\t%s\n' "/dev/video0"
|
printf '\t%s\n' "/dev/video0"
|
||||||
printf '\t%s\n' "/dev/video1"
|
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_RECORDER_ARGS="$tmp_dir/recorder-args"
|
||||||
export OMARCHY_TEST_NOTIFICATION_ARGS="$tmp_dir/notification-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"
|
"$ROOT/bin/omarchy-capture-screenrecording-with-webcam"
|
||||||
|
|
||||||
expected_menu_args="$tmp_dir/expected-menu-args"
|
expected_menu_args="$tmp_dir/expected-menu-args"
|
||||||
|
|||||||
Reference in New Issue
Block a user