From b4f21dfe65be30431c8b117de4a2ca45da2bb517 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 17 May 2026 18:03:45 +0100 Subject: [PATCH] Fixing screenrecord --- .config/waybar/indicators/screen-recording.sh | 2 +- .local/bin/station-cmd-screenrecord | 10 +++++----- .local/bin/station-menu | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.config/waybar/indicators/screen-recording.sh b/.config/waybar/indicators/screen-recording.sh index 16bd30c..4e62e97 100755 --- a/.config/waybar/indicators/screen-recording.sh +++ b/.config/waybar/indicators/screen-recording.sh @@ -1,6 +1,6 @@ #!/bin/bash -if pgrep -f "^gpu-screen-recorder" >/dev/null; then +if pgrep -f "[g]pu-screen-recorder" >/dev/null; then echo '{"text": "󰻂", "tooltip": "Stop recording", "class": "active"}' else echo '{"text": ""}' diff --git a/.local/bin/station-cmd-screenrecord b/.local/bin/station-cmd-screenrecord index bfc0cc9..151d25d 100755 --- a/.local/bin/station-cmd-screenrecord +++ b/.local/bin/station-cmd-screenrecord @@ -118,11 +118,11 @@ start_screenrecording() { } stop_screenrecording() { - pkill -SIGINT -f "^gpu-screen-recorder" # SIGINT required to save video properly + pkill -SIGINT -f "[g]pu-screen-recorder" # SIGINT required to save video properly # Wait a maximum of 5 seconds to finish before hard killing local count=0 - while pgrep -f "^gpu-screen-recorder" >/dev/null && ((count < 50)); do + while pgrep -f "[g]pu-screen-recorder" >/dev/null && ((count < 50)); do sleep 0.1 count=$((count + 1)) done @@ -130,8 +130,8 @@ stop_screenrecording() { toggle_screenrecording_indicator cleanup_webcam - if pgrep -f "^gpu-screen-recorder" >/dev/null; then - pkill -9 -f "^gpu-screen-recorder" + if pgrep -f "[g]pu-screen-recorder" >/dev/null; then + pkill -9 -f "[g]pu-screen-recorder" notify-send "Screen recording error" "Recording process had to be force-killed. Video may be corrupted." -u critical -t 5000 else trim_first_frame @@ -146,7 +146,7 @@ toggle_screenrecording_indicator() { } screenrecording_active() { - pgrep -f "^gpu-screen-recorder" >/dev/null + pgrep -f "[g]pu-screen-recorder" >/dev/null } trim_first_frame() { diff --git a/.local/bin/station-menu b/.local/bin/station-menu index c4398d7..10e4394 100755 --- a/.local/bin/station-menu +++ b/.local/bin/station-menu @@ -265,6 +265,7 @@ go_to_menu() { *system*) show_system_menu ;; *capture*) show_capture_menu ;; *toggle*) show_toggle_menu ;; + *screenrecord*) show_screenrecord_menu ;; esac }