From d725058d33cf7e52b47472f5df28bf65024b49e4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 17 Nov 2025 17:04:17 +0100 Subject: [PATCH] Make the screenrecord hotkey and menu stop recording if already recording --- bin/omarchy-cmd-screenrecord | 6 +++++- bin/omarchy-menu | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/omarchy-cmd-screenrecord b/bin/omarchy-cmd-screenrecord index 2cc60f8a..ec243ddb 100755 --- a/bin/omarchy-cmd-screenrecord +++ b/bin/omarchy-cmd-screenrecord @@ -11,12 +11,14 @@ fi DESKTOP_AUDIO="false" MICROPHONE_AUDIO="false" WEBCAM="false" +STOP_RECORDING="false" for arg in "$@"; do case "$arg" in --with-desktop-audio) DESKTOP_AUDIO="true" ;; --with-microphone-audio) MICROPHONE_AUDIO="true" ;; --with-webcam) WEBCAM="true" ;; + --stop-recording) STOP_RECORDING="true" esac done @@ -109,8 +111,10 @@ if screenrecording_active; then else stop_screenrecording fi -else +elif [[ "$STOP_RECORDING" == "false" ]]; then [[ "$WEBCAM" == "true" ]] && start_webcam_overlay start_screenrecording || cleanup_webcam +else + exit 1 fi diff --git a/bin/omarchy-menu b/bin/omarchy-menu index f82f140f..962a84a8 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -112,10 +112,12 @@ show_screenshot_menu() { } show_screenrecord_menu() { + omarchy-cmd-screenrecord --stop-recording && exit 0 + case $(menu "Screenrecord" " With desktop audio\n With desktop + microphone audio\n With desktop + microphone audio + webcam") in - *"With desktop audio"*) omarchy-cmd-screenrecord --with-desktop-audio ;; - *"With desktop + microphone audio"*) omarchy-cmd-screenrecord --with-desktop-audio --with-microphone-audio ;; - *"With desktop + microphone audio + webcam"*) omarchy-cmd-screenrecord --with-desktop-audio --with-microphone-audio --with-webcam ;; + *"With desktop audio") omarchy-cmd-screenrecord --with-desktop-audio ;; + *"With desktop + microphone audio") omarchy-cmd-screenrecord --with-desktop-audio --with-microphone-audio ;; + *"With desktop + microphone audio + webcam") omarchy-cmd-screenrecord --with-desktop-audio --with-microphone-audio --with-webcam ;; *) back_to show_capture_menu ;; esac }