mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 05:00:08 +02:00
Hands: ft-cutouts, the hand cutouts without pinches and grips
hands/ft-cutouts on|off|status starts ft-camd and ft-hands as transient user units with ft-hands' new --no-gestures: hands are published for ft-screens' cutouts, but no pinch or grip is detected, so nothing clicks or drags and a closing hand doesn't raise the tracking rate. It needs a build and ft-camd's capabilities, not hands/run.sh install. Its units conflict with ft-handsctl's, so each stops the other, and they stop with SteamVR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c377133859
commit
b417534425
3 files changed
+93
-20
No files matched your search
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
# ft-cutouts: the hand cutouts without pinches and grips. Your hands show through Frametop's
|
||||
# screens, but ft-hands runs with --no-gestures, so nothing clicks or drags. ft-handsctl on is
|
||||
# the full version; each stops the other. Like it, this doesn't start with SteamVR, and it
|
||||
# stops when SteamVR does. On the Frame.
|
||||
#
|
||||
# ft-cutouts on | off | status
|
||||
#
|
||||
# Runs this checkout's hands/build as transient user units, so it doesn't need hands/run.sh
|
||||
# install: only a build (hands/build.sh) and ft-camd's capabilities (hands/run.sh caps).
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)
|
||||
camd=frametop-cutouts-camd.service hands=frametop-cutouts-hands.service
|
||||
|
||||
die() { echo "$*" >&2; exit 1; }
|
||||
|
||||
run_unit() { # unit, the ft-handsctl unit it replaces, description, then the command
|
||||
local unit=$1 conflicts=$2 what=$3
|
||||
shift 3
|
||||
systemctl --user -q is-active "$unit" && return
|
||||
systemd-run --user --quiet --collect --unit="$unit" --description="Frametop hand cutouts: $what" \
|
||||
-p PartOf=steamvr.service -p After=steamvr.service -p Conflicts="$conflicts" \
|
||||
-p Restart=always -p RestartSec=5 -p TimeoutStopSec=5 "$@"
|
||||
}
|
||||
|
||||
case ${1:-status} in
|
||||
on)
|
||||
systemctl --user -q is-active steamvr.service || die "SteamVR isn't running"
|
||||
[ -x "$here/build/ft-camd" ] && [ -x "$here/build/ft-hands" ] || die "not built: hands/build.sh"
|
||||
grep -qa -- --no-gestures "$here/build/ft-hands" || die "ft-hands predates --no-gestures: hands/build.sh"
|
||||
getcap "$here/build/ft-camd" | grep -q cap_sys_ptrace ||
|
||||
die "ft-camd needs its capabilities: hands/run.sh caps (asks for sudo)"
|
||||
if systemctl --user -q is-active frametop-camd.service frametop-hands.service; then
|
||||
echo "stopping ft-handsctl's hand tracking (it has pinches and grips)"
|
||||
fi
|
||||
run_unit $camd frametop-camd.service "the camera broker" "$here/build/ft-camd" --status 60
|
||||
if ! systemctl --user -q is-active $hands; then
|
||||
"$here/../scripts/container-up.sh" # so stopping the unit can't take the container down
|
||||
pkill -x ft-hands || true
|
||||
fi
|
||||
run_unit $hands frametop-hands.service "hand tracking, no gestures" "$HOME/.local/bin/distrobox" enter dev -- \
|
||||
"$here/build/ft-hands" --status 60 --no-gestures
|
||||
"$here/ft-handsctl" cutouts on >/dev/null || true
|
||||
sleep 4
|
||||
"$0" status ;;
|
||||
off)
|
||||
systemctl --user stop $hands $camd 2>/dev/null || true
|
||||
systemctl --user -q is-active frametop-hands.service || pkill -x ft-hands || true
|
||||
echo "hand cutouts off" ;;
|
||||
status)
|
||||
for u in $camd $hands; do echo "$u: $(systemctl --user is-active $u || true)"; done
|
||||
echo "ft-screens cutouts: $("$here/ft-handsctl" cutouts state 2>&1)"
|
||||
journalctl --user -u $hands --no-pager -o cat -n 40 |
|
||||
grep -E '^ *[0-9.]+s |sets with a hand|cameras:' | tail -2 | cut -c1-160 || true ;;
|
||||
*) sed -n '2,10p' "$0" | sed 's/^# \{0,1\}//'; exit 2 ;;
|
||||
esac
|
||||
Reference in new issue
Block a user