31 lines
963 B
Bash
Executable File
31 lines
963 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
RECORD_DIR="$HOME/Videos"
|
|
TIMESTAMP=$(date +'%Y-%m-%d-%H-%M-%S')
|
|
AUDIO_FLAG="$1"
|
|
|
|
# Create directory if it doesn't exist
|
|
if [ ! -d "$RECORD_DIR" ]; then
|
|
mkdir -p "$RECORD_DIR"
|
|
notify-send -u low "📁 Directory Created" "$RECORD_DIR"
|
|
fi
|
|
|
|
if pgrep -x wf-recorder > /dev/null; then
|
|
killall -s SIGINT wf-recorder
|
|
notify-send -u normal "🛑 Recording Stopped" "Saved to $RECORD_DIR/"
|
|
else
|
|
if [ "$AUDIO_FLAG" = "audio" ]; then
|
|
notify-send -u normal "🔴 Recording Started" "With audio enabled"
|
|
wf-recorder --audio --file "$RECORD_DIR/${TIMESTAMP}.mp4"
|
|
else
|
|
notify-send -u normal "🔴 Recording Started" "Video only"
|
|
wf-recorder --file "$RECORD_DIR/${TIMESTAMP}.mp4"
|
|
fi
|
|
|
|
if [ $? -eq 0 ]; then
|
|
notify-send -u normal "✅ Recording Complete" "Saved as ${TIMESTAMP}.mp4"
|
|
else
|
|
notify-send -u critical "❌ Recording Failed" "Check your configuration"
|
|
fi
|
|
fi
|