From 0cebc0e9e39ac1bdf9d4f64c6ca17a7523210e80 Mon Sep 17 00:00:00 2001 From: danny Date: Mon, 11 Aug 2025 01:27:38 +0800 Subject: [PATCH] fix: handle cancelling record --- home/scripts/record.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/home/scripts/record.nix b/home/scripts/record.nix index abfadb7..0ed36bc 100644 --- a/home/scripts/record.nix +++ b/home/scripts/record.nix @@ -27,16 +27,25 @@ let rm "$PID_FILE" fi else + # Start recording choice=$(printf "%s\n" "''\${!recordOptions[@]}" | rofi -i -dmenu -config ~/.config/rofi/config.rasi -p "Which mode") - + if [[ -z "$choice" ]]; then + notify-send "󰑋 RECORD" "Cancelled" exit 1 fi mkdir -p "$OUTPUT_DIR" + geometry="$(''\${recordOptions[$choice]})" + + if [[ -z "$geometry" ]]; then + notify-send "󰑋 RECORD" "Cancelled" + exit 1 + fi + ${pkgs.wf-recorder}/bin/wf-recorder -y \ - -g "$(''\${recordOptions[$choice]})" \ + -g "$geometry" \ --audio="$SINK_DEV" \ -f "$FILENAME" & echo $! > "$PID_FILE"