Fixing screenrecord
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/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"}'
|
echo '{"text": "", "tooltip": "Stop recording", "class": "active"}'
|
||||||
else
|
else
|
||||||
echo '{"text": ""}'
|
echo '{"text": ""}'
|
||||||
|
|||||||
@@ -118,11 +118,11 @@ start_screenrecording() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop_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
|
# Wait a maximum of 5 seconds to finish before hard killing
|
||||||
local count=0
|
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
|
sleep 0.1
|
||||||
count=$((count + 1))
|
count=$((count + 1))
|
||||||
done
|
done
|
||||||
@@ -130,8 +130,8 @@ stop_screenrecording() {
|
|||||||
toggle_screenrecording_indicator
|
toggle_screenrecording_indicator
|
||||||
cleanup_webcam
|
cleanup_webcam
|
||||||
|
|
||||||
if pgrep -f "^gpu-screen-recorder" >/dev/null; then
|
if pgrep -f "[g]pu-screen-recorder" >/dev/null; then
|
||||||
pkill -9 -f "^gpu-screen-recorder"
|
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
|
notify-send "Screen recording error" "Recording process had to be force-killed. Video may be corrupted." -u critical -t 5000
|
||||||
else
|
else
|
||||||
trim_first_frame
|
trim_first_frame
|
||||||
@@ -146,7 +146,7 @@ toggle_screenrecording_indicator() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
screenrecording_active() {
|
screenrecording_active() {
|
||||||
pgrep -f "^gpu-screen-recorder" >/dev/null
|
pgrep -f "[g]pu-screen-recorder" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
trim_first_frame() {
|
trim_first_frame() {
|
||||||
|
|||||||
@@ -265,6 +265,7 @@ go_to_menu() {
|
|||||||
*system*) show_system_menu ;;
|
*system*) show_system_menu ;;
|
||||||
*capture*) show_capture_menu ;;
|
*capture*) show_capture_menu ;;
|
||||||
*toggle*) show_toggle_menu ;;
|
*toggle*) show_toggle_menu ;;
|
||||||
|
*screenrecord*) show_screenrecord_menu ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user