English | 中文
Simple bash script to make recording screen by shortcuts easily. Only work on wlroots based wayland compositors because it uses wf-recorder as backend.
- Config by environment variables
- Area selection
- Record the audio
- Notification
- Copy to your clipboard
- wf-recorder
- bash
- grep
- slurp
- libnotify
- libpulse
- wl-copy
- (optional) Add it to your PATH
- (optional) Bind it to a keybind.
- Run it for the first time it will run slurp and get an area to record and the second time it will stop recording and copy the video to your clipboard.
This script's behavior is controled by environment variables. You can make a script to set them.
# By default it can control where the file will be stored
#WFRC_FOLDER="/tmp"
# By default it can control the title of the notification and the file's name
#SCRIPT_NAME="wfrc"
# Where the lock file
#WFRC_LOCK="/tmp/WFRCLOCK"
# Set the icon of notification
#WFRC_ICON="record"
# 1 to enable full screen
#WFRC_FULL_SCREEN=0
# 0 to disable notification
#WFRC_NOTIFY=1
# Your audio device
#WFRC_AUDIO_DEV="$(LANG=C pactl list sources | grep 'Name.*output'|cut -d ' ' -f 2)"
#WFRC_FILE_NAME="$WFRC_FOLDER/$SCRIPT_NAME-$(date -u +%Y-%m-%dT%H-%M-%S).mp4"
# If no wayland, the error msg
#WFRC_NOWAYLAND="No WAYLAND_DISPLAY found. Did you run me on a wayland compositor?"
. /path/to/wfrc "$@"
Check this:
LANG=C pactl list sources | grep 'Name.*output'
If it got more than one line, it means you have more than one audio output device. Use the config script and change WFRC_AUDIO_DEV
to your device.
It's caused by wf-recorder. If the issue can be resolved by adjusting some command-line options for wf-recorder, please add those options directly to the script, and they will be passed directly to wf-recorder.
See here:
To use GPU encoding, use a VAAPI codec (for ex.
h264_vaapi
) and specify a GPU device to use with the-d
option:wf-recorder -f test-vaapi.mkv -c h264_vaapi -d /dev/dri/renderD128
...
For me, just use
wfrc -c h264_vaapi -d /dev/dri/renderD128