Add omarchy menu transcoding

This commit is contained in:
David Heinemeier Hansson
2026-05-05 13:55:21 +02:00
parent 8950fd4143
commit b8fc1bb6d9
5 changed files with 256 additions and 36 deletions
+10 -35
View File
@@ -1,58 +1,33 @@
# Transcode a video to a good-balance 1080p that's great for sharing online
# Transcoding helpers have moved to omarchy-transcode.
transcode-video-1080p() {
ffmpeg -i "$1" -vf scale=1920:1080 -c:v libx264 -preset fast -crf 23 -c:a copy "${1%.*}-1080p.mp4"
omarchy-transcode "$1" mp4 1080p
}
# Transcode a video to a good-balance 4K that's great for sharing online
transcode-video-4K() {
ffmpeg -i "$1" -c:v libx265 -preset slow -crf 24 -c:a aac -b:a 192k "${1%.*}-optimized.mp4"
omarchy-transcode "$1" mp4 4k
}
# Transcode a video to an animated GIF using a palette for accurate colors
transcode-video-gif() {
ffmpeg -i "$1" -vf "fps=10,scale=800:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" "${1%.*}.gif"
omarchy-transcode "$1" gif 1080p
}
# Transcode any image to JPG image that's great for shrinking wallpapers
img2jpg() {
img="$1"
shift
magick "$img" "$@" -quality 85 -strip "${img%.*}-converted.jpg"
omarchy-transcode "$1" jpg high
}
# Transcode any image to a small JPG (max 1080px wide)
img2jpg-small() {
img="$1"
shift
magick "$img" "$@" -resize 1080x\> -quality 85 -strip "${img%.*}-small.jpg"
omarchy-transcode "$1" jpg low
}
# Transcode any image to a 4K JPG (max 2160px wide)
img2jpg-medium() {
img="$1"
shift
magick "$img" "$@" -resize 2160x\> -quality 85 -strip "${img%.*}-medium.jpg"
omarchy-transcode "$1" jpg medium
}
# Transcode any image to a 6K JPG (max 3160px wide)
img2jpg-large() {
img="$1"
shift
magick "$img" "$@" -resize 3160x\> -quality 85 -strip "${img%.*}-large.jpg"
omarchy-transcode "$1" jpg high
}
# Transcode any image to compressed-but-lossless PNG
img2png() {
img="$1"
shift
magick "$img" "$@" -strip -define png:compression-filter=5 \
-define png:compression-level=9 \
-define png:compression-strategy=1 \
-define png:exclude-chunk=all \
"${img%.*}-optimized.png"
omarchy-transcode "$1" png high
}
+3
View File
@@ -43,6 +43,9 @@ bindd = SUPER CTRL, PRINT, Extract text (OCR) from screenshot, exec, omarchy-cap
# File sharing
bindd = SUPER CTRL, S, Share, exec, omarchy-menu share
# Transcoding
bindd = SUPER CTRL, R, Transcode, exec, omarchy-menu transcode
# Waybar-less information
bindd = SUPER CTRL ALT, T, Show time, exec, notify-send -u low " $(date +"%A %H:%M · %d %B %Y · Week %V")"
bindd = SUPER CTRL ALT, B, Show battery remaining, exec, notify-send -u low "$(omarchy-battery-status)"