#!/bin/env bash # Menu launcher wrapper menu_prompt() { if command -v tofi &>/dev/null; then printf "%b" "$1" | tofi --prompt-text="$2" elif command -v fuzzel &>/dev/null; then printf "%b" "$1" | fuzzel -d -p "$2" -w 25 -l 10 elif command -v wofi &>/dev/null; then printf "%b" "$1" | wofi --dmenu --prompt="$2" elif command -v rofi &>/dev/null; then printf "%b" "$1" | rofi -dmenu -p "$2" else notify-send "No compatible launcher found" "Install tofi, fuzzel, wofi, or rofi." exit 1 fi } # Directories SCREENSHOT_DIR="${HOME}/Pictures" RECORDING_DIR="${HOME}/Videos" # Ensure directories exist mkdir -p "$SCREENSHOT_DIR" "$RECORDING_DIR" # Stop active wl-screenrec session if pgrep -u "$USER" wl-screenrec > /dev/null; then pkill -INT -u "$USER" wl-screenrec notify-send "Recording stopped" # Ask if user wants to compress the video COMPRESS=$(menu_prompt "āœ… compress\nāŒ keep original" "šŸ—œļø Compress video?") if [[ "$COMPRESS" == "āœ… compress" ]]; then # Find the most recent video file LATEST_VIDEO=$(find "$RECORDING_DIR" -name "*.mp4" -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2-) if [[ -n "$LATEST_VIDEO" ]] && [[ -f "$LATEST_VIDEO" ]]; then COMPRESSED_VIDEO="${LATEST_VIDEO%.mp4}_compressed.mp4" notify-send "Compressing video..." "This may take a moment" if ffmpeg -i "$LATEST_VIDEO" -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k "$COMPRESSED_VIDEO" -y &>/dev/null; then notify-send "Compression complete" "$COMPRESSED_VIDEO" # Ask if user wants to delete original DELETE_ORIGINAL=$(menu_prompt "šŸ—‘ļø delete original\nšŸ“ keep both" "Delete original?") if [[ "$DELETE_ORIGINAL" == "šŸ—‘ļø delete original" ]]; then rm "$LATEST_VIDEO" notify-send "Original deleted" "Keeping compressed version only" fi else notify-send "Compression failed" "Keeping original file" fi fi fi exit 0 fi # Get current outputs dynamically OUTPUTS=$(hyprctl monitors | grep "Monitor" | awk '{print $2}' | paste -sd " " -) OPTIONS=$( cat <