diff --git a/dot_config/polybar/executable_voxtype-polybar.sh b/dot_config/polybar/executable_voxtype-polybar.sh index b73d2d5db83f8676cb37cb5b1a5aaf0d3e556e92..c66158b2fcc2c10b202ee339f49174efd383c411 100644 --- a/dot_config/polybar/executable_voxtype-polybar.sh +++ b/dot_config/polybar/executable_voxtype-polybar.sh @@ -10,6 +10,10 @@ # color_primary - accent/alert color (used for recording) # color_secondary - secondary accent (used for transcribing) +# Respect XDG_STATE_HOME for log location +state_dir="${XDG_STATE_HOME:-$HOME/.local/state}/voxtype" +log_file="$state_dir/voxtype.log" + output=$(voxtype status --format json 2>/dev/null) if [[ -z "$output" ]]; then @@ -22,7 +26,8 @@ alt=$(echo "$output" | jq -r '.alt // "idle"') # Handle toggle action if [[ "$1" == "toggle" ]]; then if [[ "$alt" == "stopped" ]]; then - setsid fish -c "opx voxtype" >/dev/null 2>&1 & + mkdir -p "$state_dir" + setsid fish -c "voxtype" >>"$log_file" 2>&1 & else voxtype record toggle fi