diff --git a/dots/.config/quickshell/ii/scripts/videos/record.sh b/dots/.config/quickshell/ii/scripts/videos/record.sh index f6410838c..bf0ab504d 100755 --- a/dots/.config/quickshell/ii/scripts/videos/record.sh +++ b/dots/.config/quickshell/ii/scripts/videos/record.sh @@ -8,26 +8,21 @@ CUSTOM_PATH=$(jq -r "$JSON_PATH" "$CONFIG_FILE" 2>/dev/null) RECORDING_DIR="" if [[ -n "$CUSTOM_PATH" ]]; then - RECORDING_DIR="$CUSTOM_PATH" + RECORDING_DIR="$CUSTOM_PATH" else - RECORDING_DIR="$HOME/Videos" + RECORDING_DIR="$HOME/Videos" # Use default path fi getdate() { - date '+%Y-%m-%d_%H.%M.%S' + date '+%Y-%m-%d_%H.%M.%S' } getaudiooutput() { - pactl list sources | grep 'Name' | grep 'monitor' | cut -d ' ' -f2 + pactl list sources | grep 'Name' | grep 'monitor' | cut -d ' ' -f2 } getactivemonitor() { - hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name' + hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name' } -# ORİJİNAL XDG MANTIĞI SİLİNDİ, YERİNE SADECE YENİ DEĞİŞKEN KULLANILDI -# xdgvideo="$(xdg-user-dir VIDEOS)" -# if $xdgvideo = "$HOME" ]]; then -# unset xdgvideo -# fi mkdir -p "$RECORDING_DIR" cd "$RECORDING_DIR" || exit @@ -37,47 +32,47 @@ MANUAL_REGION="" SOUND_FLAG=0 FULLSCREEN_FLAG=0 for ((i=0;i<${#ARGS[@]};i++)); do - if [[ "${ARGS[i]}" == "--region" ]]; then - if (( i+1 < ${#ARGS[@]} )); then - MANUAL_REGION="${ARGS[i+1]}" - else - notify-send "Recording cancelled" "No region specified for --region" -a 'Recorder' & disown - exit 1 - fi - elif [[ "${ARGS[i]}" == "--sound" ]]; then - SOUND_FLAG=1 - elif [[ "${ARGS[i]}" == "--fullscreen" ]]; then - FULLSCREEN_FLAG=1 - fi + if [[ "${ARGS[i]}" == "--region" ]]; then + if (( i+1 < ${#ARGS[@]} )); then + MANUAL_REGION="${ARGS[i+1]}" + else + notify-send "Recording cancelled" "No region specified for --region" -a 'Recorder' & disown + exit 1 + fi + elif [[ "${ARGS[i]}" == "--sound" ]]; then + SOUND_FLAG=1 + elif [[ "${ARGS[i]}" == "--fullscreen" ]]; then + FULLSCREEN_FLAG=1 + fi done if pgrep wf-recorder > /dev/null; then - notify-send "Recording Stopped" "Stopped" -a 'Recorder' & - pkill wf-recorder & + notify-send "Recording Stopped" "Stopped" -a 'Recorder' & + pkill wf-recorder & else - if [[ $FULLSCREEN_FLAG -eq 1 ]]; then - notify-send "Starting recording" 'recording_'"$(getdate)"'.mp4' -a 'Recorder' & disown - if [[ $SOUND_FLAG -eq 1 ]]; then - wf-recorder -o "$(getactivemonitor)" --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --audio="$(getaudiooutput)" - else - wf-recorder -o "$(getactivemonitor)" --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t - fi - else - # If a manual region was provided via --region, use it; otherwise run slurp as before. - if [[ -n "$MANUAL_REGION" ]]; then - region="$MANUAL_REGION" - else - if ! region="$(slurp 2>&1)"; then - notify-send "Recording cancelled" "Selection was cancelled" -a 'Recorder' & disown - exit 1 - fi - fi + if [[ $FULLSCREEN_FLAG -eq 1 ]]; then + notify-send "Starting recording" 'recording_'"$(getdate)"'.mp4' -a 'Recorder' & disown + if [[ $SOUND_FLAG -eq 1 ]]; then + wf-recorder -o "$(getactivemonitor)" --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --audio="$(getaudiooutput)" + else + wf-recorder -o "$(getactivemonitor)" --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t + fi + else + # If a manual region was provided via --region, use it; otherwise run slurp as before. + if [[ -n "$MANUAL_REGION" ]]; then + region="$MANUAL_REGION" + else + if ! region="$(slurp 2>&1)"; then + notify-send "Recording cancelled" "Selection was cancelled" -a 'Recorder' & disown + exit 1 + fi + fi - notify-send "Starting recording" 'recording_'"$(getdate)"'.mp4' -a 'Recorder' & disown - if [[ $SOUND_FLAG -eq 1 ]]; then - wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region" --audio="$(getaudiooutput)" - else - wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region" - fi - fi + notify-send "Starting recording" 'recording_'"$(getdate)"'.mp4' -a 'Recorder' & disown + if [[ $SOUND_FLAG -eq 1 ]]; then + wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region" --audio="$(getaudiooutput)" + else + wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$region" + fi + fi fi \ No newline at end of file