diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-09-22 16:21:40 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-09-22 16:21:40 +0800 |
| commit | 258062b5b85ef41108348e13cebc44db6b2c9b12 (patch) | |
| tree | 003dd62e0c74e2cffcc9bc3085b6d3f155024c54 | |
| parent | e35aaebb534eafb30ba8662ea6624b4955aa4070 (diff) | |
init rec.sh
| -rwxr-xr-x | rec.sh | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -0,0 +1,44 @@ +#!/bin/sh + +XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache} + +function status() { + pstatus=$(cat $XDG_CACHE_HOME/rec_paused) + if [ "$pstatus" == "true" ]; then + echo "" + exit + fi + if pgrep -f gpu-screen-recorder >/dev/null; then + echo "" + else + echo "" + fi +} + +function recorder() { + if pgrep -f gpu-screen-recorder>/dev/null; then + killall -SIGINT gpu-screen-recorder || exit 1 + # reload module + pkill -RTMIN+3 waybar + else + gpu-screen-recorder -w screen -restore-portal-session yes -q ultra -oc yes -cr full -f 160 -o $XDG_VIDEOS_DIR/$(date +"%Y-%m-%d_%H:%M:%S").mp4 + # reload module + pkill -RTMIN+3 waybar + fi +} + +function pause() { + killall -SIGUSR2 gpu-screen-recorder || exit 1 + pstatus=$(cat $XDG_CACHE_HOME/rec_paused) + if [ "$pstatus" == "true" ]; then + echo "false" > $XDG_CACHE_HOME/rec_paused + else + echo "true" > $XDG_CACHE_HOME/rec_paused + fi + # reload module + pkill -RTMIN+3 waybar +} + +if [ "$1" ]; then + $@ +fi |
