From acb2c37b1f489ae9a87692fea85335b4440a55d8 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 8 May 2026 12:40:54 +0200 Subject: [PATCH] Have transcode flow through walker menus rather than gum prompts --- bin/omarchy-menu | 11 +----- bin/omarchy-transcode | 54 ++++++++-------------------- default/hypr/bindings/utilities.conf | 2 +- 3 files changed, 17 insertions(+), 50 deletions(-) diff --git a/bin/omarchy-menu b/bin/omarchy-menu index c8746cfb..d1981bd9 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -102,7 +102,7 @@ show_trigger_menu() { case $(menu "Trigger" "󰔛 Reminder\n Capture\n󰧸 Transcode\n Share\n󰔎 Toggle\n Hardware") in *Reminder*) show_reminder_menu ;; *Capture*) show_capture_menu ;; - *Transcode*) show_transcode_menu ;; + *Transcode*) omarchy-transcode ;; *Share*) show_share_menu ;; *Toggle*) show_toggle_menu ;; *Hardware*) show_hardware_menu ;; @@ -209,14 +209,6 @@ show_share_menu() { esac } -show_transcode_menu() { - case $(menu "Transcode" " Picture\n Video") in - *Picture*) present_terminal "omarchy-transcode --path '$HOME/Pictures'" ;; - *Video*) present_terminal "omarchy-transcode --path '$HOME/Videos'" ;; - *) back_to show_trigger_menu ;; - esac -} - show_toggle_menu() { local options="󱄄 Screensaver\n󰔎 Nightlight\n󱫖 Idle Lock\n󰂛 Notifications\n󰍜 Top Bar\n󱂬 Workspace Layout\n Window Gaps\n 1-Window Ratio\n󰍹 Monitor Scaling\n Direct Boot\n󰟵 Passwordless Sudo" @@ -857,7 +849,6 @@ go_to_menu() { *toggle*) show_toggle_menu ;; *hardware*) show_hardware_menu ;; *share*) show_share_menu ;; - *transcode*) show_transcode_menu ;; *reminder-set*) show_custom_reminder_input ;; *reminder*) show_reminder_menu ;; *background*) show_background_menu ;; diff --git a/bin/omarchy-transcode b/bin/omarchy-transcode index 66495db1..1602e493 100755 --- a/bin/omarchy-transcode +++ b/bin/omarchy-transcode @@ -13,7 +13,7 @@ usage() { Usage: omarchy transcode [--path path] [input] [format] [resolution] -With no input, fuzzy-pick a picture or video from ~/Pictures and ~/Videos, +With no input, pick a picture or video with Walker from ~/Pictures and ~/Videos, or only from --path when provided. Then pick the output format and resolution. Options: @@ -29,30 +29,6 @@ Resolutions: EOF } -pick_file() { - local search_path="$1" - local paths=() - - if [[ -n $search_path ]]; then - [[ -e $search_path ]] || { echo "Path not found: $search_path" >&2; return 1; } - paths=("$search_path") - else - paths=("$HOME/Pictures" "$HOME/Videos") - fi - - find "${paths[@]}" -type f \ - \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' -o -iname '*.gif' -o -iname '*.heic' -o -iname '*.avif' \ - -o -iname '*.mp4' -o -iname '*.mov' -o -iname '*.m4v' -o -iname '*.mkv' -o -iname '*.webm' -o -iname '*.avi' \) \ - -printf '%T@\t%p\n' 2>/dev/null | sort -rn | cut -f2- | fzf --layout=reverse-list --prompt="Transcode file> " -} - -pick_option() { - local prompt="$1" - shift - - gum choose --header "$prompt" "$@" -} - media_type() { local mime mime=$(file -b --mime-type "$1") @@ -187,9 +163,10 @@ main() { input="${positional[0]:-}" format="${positional[1]:-}" resolution="${positional[2]:-}" + search_path="${search_path:-$HOME/Pictures:$HOME/Videos}" if [[ -z $input ]]; then - input=$(pick_file "$search_path") + input=$(omarchy-menu-file "Transcode picture or video" "$search_path" "jpg jpeg png webp gif heic avif mp4 mov m4v mkv webm avi") fi [[ -n $input ]] || return 1 @@ -199,33 +176,32 @@ main() { if [[ -z $format ]]; then if [[ $type == "picture" ]]; then - format=$(pick_option "Select format..." jpg png) + format=$(omarchy-menu-select "Select format" jpg png) else - format=$(pick_option "Select format..." mp4 gif) + format=$(omarchy-menu-select "Select format" mp4 gif) fi fi if [[ -z $resolution ]]; then if [[ $type == "picture" ]]; then - resolution=$(pick_option "Select resolution..." high medium low) + resolution=$(omarchy-menu-select "Select resolution" high medium low) else - resolution=$(pick_option "Select resolution..." 4k 1080p 720p) + resolution=$(omarchy-menu-select "Select resolution" 4k 1080p 720p) fi fi output=$(output_path "$input" "$format" "$resolution") - if [[ $type == "picture" ]]; then - transcode_picture "$input" "$format" "$resolution" "$output" - else + if [[ $type == "video" ]]; then + omarchy-notification-send "" "Transcoding video…" "$(basename -- "$input") to $format ($resolution)" transcode_video "$input" "$format" "$resolution" "$output" - echo "" + copy_to_clipboard "$output" + omarchy-notification-send "" "Transcoded to $resolution $format" "Saved and copied to clipboard." + else + transcode_picture "$input" "$format" "$resolution" "$output" + copy_to_clipboard "$output" + omarchy-notification-send "" "Transcoded to $resolution $format" "Saved and copied to clipboard." fi - - copy_to_clipboard "$output" - echo "Your $type has been transcoded into $format as $resolution. It's on your clipboard." - echo "" - echo "It's also in $output" } main "$@" diff --git a/default/hypr/bindings/utilities.conf b/default/hypr/bindings/utilities.conf index 8bac901a..ef8ef0d3 100644 --- a/default/hypr/bindings/utilities.conf +++ b/default/hypr/bindings/utilities.conf @@ -44,7 +44,7 @@ bindd = SUPER CTRL, PRINT, Extract text (OCR) from screenshot, exec, omarchy-cap bindd = SUPER CTRL, S, Share, exec, omarchy-menu share # Transcoding -bindd = SUPER CTRL, PERIOD, Transcode, exec, omarchy-menu transcode +bindd = SUPER CTRL, PERIOD, Transcode, exec, omarchy-transcode # Reminders bindd = SUPER CTRL, R, Set reminder, exec, omarchy-menu reminder-set