mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 12:19:24 +00:00
Cleanup the screenrecording script
This commit is contained in:
@ -1,34 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Set recorder based on GPU
|
# Set recorder based on GPU
|
||||||
if lspci | grep -qi 'nvidia'; then
|
|
||||||
RECORDER="wf-recorder"
|
|
||||||
RECORDER_ARGS="-c libx264 -p crf=23 -p preset=medium -p movflags=+faststart"
|
|
||||||
else
|
|
||||||
RECORDER="wl-screenrec"
|
|
||||||
RECORDER_ARGS="--ffmpeg-encoder-options=\"-c:v libx264 -crf 23 -preset medium -movflags +faststart\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
screenrecording() {
|
screenrecording() {
|
||||||
local filename
|
|
||||||
filename="$HOME/Videos/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4"
|
filename="$HOME/Videos/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4"
|
||||||
notify-send "Screen recording starting..." -t 1000
|
notify-send "Screen recording starting..." -t 1000
|
||||||
sleep 1
|
sleep 1
|
||||||
eval "$RECORDER -f \"$filename\" $RECORDER_ARGS \"\$@\""
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_recording() {
|
if lspci | grep -qi 'nvidia'; then
|
||||||
if pgrep -x "$RECORDER" >/dev/null; then
|
wf-recorder -f "$filename" -c libx264 -p crf=23 -p preset=medium -p movflags=+faststart "$@"
|
||||||
pkill -x "$RECORDER"
|
else
|
||||||
notify-send "Screen recording saved to ~/Videos" -t 2000
|
wl-screenrec -f "$filename" --ffmpeg-encoder-options="-c:v libx264 -crf 23 -preset medium -movflags +faststart" "$@"
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if stop_recording; then
|
if pgrep -x wl-screenrec >/dev/null || pgrep -x wf-recorder >/dev/null; then
|
||||||
# Recording was stopped
|
pkill -x wl-screenrec
|
||||||
:
|
pkill -x wf-recorder
|
||||||
|
notify-send "Screen recording saved to ~/Videos" -t 2000
|
||||||
elif [[ "$1" == "output" ]]; then
|
elif [[ "$1" == "output" ]]; then
|
||||||
screenrecording
|
screenrecording
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user