summaryrefslogtreecommitdiff
path: root/.local/bin/recordmenu
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2023-10-25 18:02:25 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2023-10-25 18:02:25 -0400
commitcb1a51092d12db12f7ba29e57daed6d64b311d38 (patch)
tree3c4e0bf555d079b9bc4f04889aa2cc6bb4f91255 /.local/bin/recordmenu
parent6312ef191a9ab7466ec72bb3aba7138816062c2f (diff)
More cleanup
Diffstat (limited to '.local/bin/recordmenu')
-rwxr-xr-x.local/bin/recordmenu105
1 files changed, 0 insertions, 105 deletions
diff --git a/.local/bin/recordmenu b/.local/bin/recordmenu
deleted file mode 100755
index 32b0a34..0000000
--- a/.local/bin/recordmenu
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/bin/sh
-
-# Usage:
-# `record`: Ask for recording type via dmenu
-# `record screencast`: Record both audio and screen
-# `record video`: Record only screen
-# `record audio`: Record only audio
-# `record kill`: Kill existing recording
-#
-# If there is already a running instance, user will be prompted to end it.
-
-updateicon() { \
- echo "$1" > /tmp/recordingicon
- pkill -RTMIN+9 i3blocks
- }
-
-killrecording() {
- recpid="$(cat /tmp/recordingpid)"
- # kill with SIGTERM, allowing finishing touches.
- kill -15 "$recpid"
- rm -f /tmp/recordingpid
- updateicon ""
- pkill -RTMIN+9 i3blocks
- # even after SIGTERM, ffmpeg may still run, so SIGKILL it.
- sleep 3
- kill -9 "$recpid"
- exit
- }
-
-screencast() { \
- ffmpeg -y \
- -f x11grab \
- -framerate 60 \
- -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
- -i :0.0 \
- -f alsa -i default \
- -r 30 \
- -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \
- "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" &
- echo $! > /tmp/recordingpid
- updateicon ""
- }
-
-video() { ffmpeg \
- -f x11grab \
- -s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
- -i :0.0 \
- -c:v libx264 -qp 0 -r 30 \
- "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
- echo $! > /tmp/recordingpid
- updateicon ""
- }
-
-webcamhidef() { ffmpeg \
- -f v4l2 \
- -i /dev/video0 \
- -video_size 1920x1080 \
- "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
- echo $! > /tmp/recordingpid
- updateicon ""
- }
-
-webcam() { ffmpeg \
- -f v4l2 \
- -i /dev/video0 \
- -video_size 640x480 \
- "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
- echo $! > /tmp/recordingpid
- updateicon ""
- }
-
-
-audio() { \
- ffmpeg \
- -f alsa -i default \
- -c:a flac \
- "$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
- echo $! > /tmp/recordingpid
- updateicon ""
- }
-
-askrecording() { \
- choice=$(printf "screencast\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style")
- case "$choice" in
- screencast) screencast;;
- audio) audio;;
- video) video;;
- webcam) webcam;;
- "webcam (hi-def)") webcamhidef;;
- esac
- }
-
-asktoend() { \
- response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
- [ "$response" = "Yes" ] && killrecording
- }
-
-
-case "$1" in
- screencast) screencast;;
- audio) audio;;
- video) video;;
- kill) killrecording;;
- *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
-esac