summary refs log tree commit diff
path: root/bin/wfez
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2026-02-10 12:32:48 +0100
committerRobert Günzler <r@gnzler.io>2026-02-10 12:41:25 +0100
commit63feeb9f369fc6176e85c1c2d8fcc863caad1946 (patch)
tree41cd5d2d1ec36e74e464caab722cc9b460153f04 /bin/wfez
parent5bd0a4aca65ecb9818ef1285982d160b6b6ff665 (diff)
start new
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bin/wfez')
-rwxr-xr-xbin/wfez102
1 files changed, 0 insertions, 102 deletions
diff --git a/bin/wfez b/bin/wfez
deleted file mode 100755
index 45ef438..0000000
--- a/bin/wfez
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh
-set -e
-[ -n "$DEBUG" ] && set -x
-
-audio="$(pactl info | grep "Default Sink" | cut -d':' -f2 | xargs -L1).monitor"
-output=$(swq current output)
-showkeys=
-ask=
-crop=
-hwacc=
-output_file="${HOME}/Videos/wf_$(date +%FT%T).mkv"
-
-optstring="a:o:kAcHnh"
-while getopts "${optstring}" opt; do
-	case "${opt}" in
-	a) audio="${OPTARG}" ;;
-	o) output="${OPTARG}" ;;
-	k) showkeys=1 ;;
-	A) ask=1 ;;
-	c) crop=1 ;;
-	H) hwacc=1 ;;
-	h | ?)
-		printf 'usage: %s [-%s] [FILE]\n' "$(basename "$0")" "$(printf '%s' "${optstring}" | tr -d ':')"
-		printf '\n'
-		printf ' Launches wf-recorder(1) with optimized settings.\n'
-		printf ' When FILE is omitted, use %s.\n' "${output_file}"
-		printf '\n'
-		printf ' -a  audio to record (default: %s)\n' "${audio}"
-		printf ' -o  output to record (default: %s)\n' "${output}"
-		printf ' -k  show keypresses; using wshowkeys(1)\n'
-		printf ' -A  select audio/output interactively\n'
-		printf ' -c  select an area of the screen to be recorded; using slurp(1)\n'
-		printf ' -H  enable hardware-accelerated recording (usually reduces quality)\n'
-		printf '\n'
-		exit 2
-		;;
-	esac
-done
-shift $((OPTIND - 1))
-
-[ -n "${1}" ] && output_file=$1
-
-# select audio sink to record
-if [ ! "${audio}" = "none" ] && [ -n "${ask}" ]; then
-	audio=$(MENU_PROMPT="wfez: choose audio:" soundswitch -j -O)
-	audio="${audio}.monitor"
-fi
-
-[ ! "${audio}" = "none" ] && audio_arg="-a ${audio}"
-
-# select output to record
-[ -n "${ask}" ] && output=$(slurp -o)
-
-if [ -n "${showkeys}" ]; then
-	printf "Starting wshowkeys on %s\n" "${output}"
-	pritnf "WARNING: currently the -o flag to force display to a specific output is not implemented\n" >&2
-	#  -o ${output}
-	sway exec "wshowkeys -a bottom -a left -F 'Iosevka Aile 25' -t 1" >/dev/null
-	trap '{ pkill wshowkeys; }' EXIT
-fi
-
-if [ -n "${crop}" ]; then
-	selection=
-	case $(printf "manual\nworkspace\ncontainer\n" | MENU_PROMPT="wfez: crop mode" menu -l5) in
-	manual)
-		geom=$(slurp -f "%o:%x,%y %wx%h")
-		;;
-	container)
-		selection=$(swq list con | jq -r '.[]|select(.name? and .visible?==true)|[.id, .name, (.type=="floating_con")]|join("\t")' | awk '{c="swq locate output-for-con "$1" | jq -r \"first | .name\""; c|getline o; close(c); printf "%3s\t%10s\t%8s\t%s\n", $1, $2, ($3 == "true" ? "floating" : "normal"), o}' | MENU_PROMPT="wfez: select container" menu -l5)
-		con_id=$(printf '%s' "$selection" | awk '{print $1}')
-		con_pos=$(swq has id "$con_id" | swq geometry)
-		con_out=$(swq | jq -r --argjson a "{\"id\":$con_id}" '..|select(.type?=="workspace" and (([.floating_nodes[], .nodes[]])|..|select(.id?==$a.id)))|.output')
-		geom="${con_out}:${con_pos}"
-		;;
-	*)
-		printf "not implemented\n" >&2
-		exit 1
-		;;
-	esac
-	output="$(printf '%s' "${geom}" | cut -d: -f1)"
-	geometry_arg="-g $(printf '%s' "${geom}" | cut -d: -f2-)"
-fi
-
-if [ -n "${hwacc}" ]; then
-	hwacc_arg='-c h264_vaapi -d /dev/dri/renderD128'
-fi
-
-makoctl set-mode off
-
-set -x
-wf-recorder -o "${output}" "${audio_arg}" "${geometry_arg}" "${hwacc_arg}" -f "${output_file}"
-set +x
-
-if [ ! "${audio}" = "none" ]; then
-	# correct mono audio in stereo channel
-	mv "${output_file}" /tmp/wfrec_tmp.mkv
-	trap '{ rm /tmp/wfrec_tmp.mkv; }' EXIT
-	ffmpeg -hide_banner -i /tmp/wfrec_tmp.mkv -vcodec copy -af "pan=mono|c0=c0" "${output_file}"
-fi
-
-makoctl set-mode ''
-notify-send wfez "$output_file"