fixes waybar. moves stuff to vicinae
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
#!/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
|
||||
}
|
||||
# CLI options
|
||||
DMENU_CMD=""
|
||||
while getopts ":d:" opt; do
|
||||
case "$opt" in
|
||||
d) DMENU_CMD="$OPTARG" ;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
if [ -z "$DMENU_CMD" ]; then
|
||||
notify-send "Missing launcher" "Use -d to provide a dmenu command"
|
||||
exit 1
|
||||
fi
|
||||
read -r -a DMENU_ARR <<< "$DMENU_CMD"
|
||||
DMENU_BIN="${DMENU_ARR[0]}"
|
||||
command -v "$DMENU_BIN" &>/dev/null || { notify-send "Launcher not found" "$DMENU_BIN is not installed"; exit 1; }
|
||||
|
||||
# Directories
|
||||
SCREENSHOT_DIR="${HOME}/Pictures"
|
||||
@@ -29,7 +31,7 @@ if pgrep -u "$USER" wl-screenrec > /dev/null; then
|
||||
notify-send "Recording stopped"
|
||||
|
||||
# Ask if user wants to compress the video
|
||||
COMPRESS=$(menu_prompt "✅ compress\n❌ keep original" "🗜️ Compress video?")
|
||||
COMPRESS=$(printf "%b" "✅ compress\n❌ keep original" | "${DMENU_ARR[@]}" "🗜️ 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-)
|
||||
@@ -39,7 +41,7 @@ if pgrep -u "$USER" wl-screenrec > /dev/null; then
|
||||
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?")
|
||||
DELETE_ORIGINAL=$(printf "%b" "🗑️ delete original\n📁 keep both" | "${DMENU_ARR[@]}" "Delete original?")
|
||||
if [[ "$DELETE_ORIGINAL" == "🗑️ delete original" ]]; then
|
||||
rm "$LATEST_VIDEO"
|
||||
notify-send "Original deleted" "Keeping compressed version only"
|
||||
@@ -66,12 +68,12 @@ record all
|
||||
EOF
|
||||
)
|
||||
|
||||
SELECTION=$(menu_prompt "$OPTIONS" " ")
|
||||
SELECTION=$(printf "%b" "$OPTIONS" | "${DMENU_ARR[@]}" " ")
|
||||
[ -z "$SELECTION" ] && exit 0
|
||||
|
||||
# Ask for audio mode if it's a recording
|
||||
select_audio_mode() {
|
||||
AUDIO_MODE=$(menu_prompt "🎤 mic\n💻 internal\n🚫 none" "🎙️ Audio?")
|
||||
AUDIO_MODE=$(printf "%b" "🎤 mic\n💻 internal\n🚫 none" | "${DMENU_ARR[@]}" "🎙️ Audio?")
|
||||
[ -z "$AUDIO_MODE" ] && echo "__cancel__" && return
|
||||
|
||||
case "$AUDIO_MODE" in
|
||||
|
||||
Reference in New Issue
Block a user