#!/bin/sh # Check if wf-recorder is already running if pgrep -x "wf-recorder" > /dev/null; then current_file=$(ps -o args= -C wf-recorder | head -n1 | grep -oE '[^ ]+\.mp4' | tail -n1) pkill -2 wf-recorder sleep 1 # Force kill if still running pkill wf-recorder 2>/dev/null exit 0 fi datetime=$(date +"%d.%m.%Y %H:%M:%S") mode=$(echo -e "動画のみ\nマイク\nシステムの音\n全面的" | rofi \ -modes drun,run,calc \ -dmenu -p "ビデオ録画モードを選択 " \ -theme "$HOME/.config/rofi/styles/style-recorder.rasi" \ -markup-rows \ -drun-use-desktop-cache \ ) if [[ -z "$mode" ]]; then notify-send --hint int:transient:1 -t 1000 "Recorder" "Aborting" exit 1 fi wf-recorder -c libx264rgb -r 30 -a --audio-backend=pipewire -f "$HOME/Videos/$datetime.mkv" notify-send --hint int:transient:1 -t 1000 "Recorder" "Video saved as $datetime.mkv"