mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 04:09:23 +00:00
wf-recorder instead of wl-screenrec (NVIDIA support for screen recording) (#278)
* use wf-recorder instead of wl-screenrec wl-screenrec does not support NVIDIA drivers as of now * install wf-recorder and migration for it * use wl-screenrec for non-nvidia and wf-recorder otherwise * useless comment * only use one of the screen recording features
This commit is contained in:
@ -1,19 +1,36 @@
|
||||
#!/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
|
||||
wl-screenrec \
|
||||
-f "$HOME/Videos/screenrecording-$(date +'%Y-%m-%d_%H-%M-%S').mp4" \
|
||||
--ffmpeg-encoder-options="-c:v libx264 -crf 23 -preset medium -movflags +faststart" \
|
||||
"$@"
|
||||
eval "$RECORDER -f \"$filename\" $RECORDER_ARGS \"\$@\""
|
||||
}
|
||||
|
||||
if pgrep -x wl-screenrec >/dev/null; then
|
||||
pkill -x wl-screenrec
|
||||
notify-send "Screen recording saved to ~/Videos" -t 2000
|
||||
stop_recording() {
|
||||
if pgrep -x "$RECORDER" >/dev/null; then
|
||||
pkill -x "$RECORDER"
|
||||
notify-send "Screen recording saved to ~/Videos" -t 2000
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
if stop_recording; then
|
||||
# Recording was stopped
|
||||
:
|
||||
elif [[ "$1" == "output" ]]; then
|
||||
screenrecording -o ""
|
||||
screenrecording
|
||||
else
|
||||
region=$(slurp) || exit 1
|
||||
screenrecording -g "$region"
|
||||
|
@ -1,9 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
yay -S --noconfirm --needed \
|
||||
brightnessctl playerctl pamixer wiremix wireplumber \
|
||||
# Base packages
|
||||
PACKAGES="brightnessctl playerctl pamixer wiremix wireplumber \
|
||||
fcitx5 fcitx5-gtk fcitx5-qt wl-clip-persist \
|
||||
nautilus sushi ffmpegthumbnailer \
|
||||
slurp wl-screenrec satty \
|
||||
slurp satty \
|
||||
mpv evince imv \
|
||||
chromium
|
||||
chromium"
|
||||
|
||||
# Add screen recorder based on GPU
|
||||
if [ -n "$(lspci | grep -i 'nvidia')" ]; then
|
||||
PACKAGES="$PACKAGES wf-recorder"
|
||||
else
|
||||
PACKAGES="$PACKAGES wl-screenrec"
|
||||
fi
|
||||
|
||||
yay -S --noconfirm --needed $PACKAGES
|
||||
|
11
migrations/1753176520.sh
Normal file
11
migrations/1753176520.sh
Normal file
@ -0,0 +1,11 @@
|
||||
echo "Install wf-recorder for screen recording for nvidia"
|
||||
|
||||
if [ -n "$(lspci | grep -i 'nvidia')" ]; then
|
||||
if ! command -v wf-recorder &>/dev/null; then
|
||||
yay -S --noconfirm --needed wf-recorder
|
||||
fi
|
||||
|
||||
if command -v wl-screenrec &>/dev/null; then
|
||||
yay -R --noconfirm wl-screenrec
|
||||
fi
|
||||
fi
|
Reference in New Issue
Block a user