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