Compare commits

..

No commits in common. "main" and "v0.1.0" have entirely different histories.
main ... v0.1.0

4 changed files with 53 additions and 108 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
/omagrab /omagrab
/dist/ /dist/
*.bak *.bak
NOTES.md

View file

@ -9,9 +9,20 @@ URL, pick Audio or Video, and watch it download with live progress. Built with G
> Wayland + `wl-clipboard`, and a Nerd Font terminal. There are no X11 / > Wayland + `wl-clipboard`, and a Nerd Font terminal. There are no X11 /
> non-Omarchy fallbacks. > non-Omarchy fallbacks.
<p align="center"> ```
<img src="docs/screenshot.png" alt="omagrab TUI" width="700"> omagrab
</p>
Audio ▐ Video ▌
▸ paste a URL and press enter…
✓ Big Buck Bunny (1080p) done
Sintel — Blender Open Movie ████████░░ 62% 4.2MiB/s
○ another queued link queued
tab audio/video · enter add · ↑↓ select · esc quit
empty box → c config · d remove · q quit
```
## Features ## Features
@ -43,8 +54,8 @@ sudo pacman -S yt-dlp ffmpeg wl-clipboard
## Install ## Install
One line — pulls in `yt-dlp`, `ffmpeg` and `wl-clipboard` via pacman if they're One line — pulls in `yt-dlp`, `ffmpeg` and `wl-clipboard` via pacman if they're
missing, installs the binary to `~/.local/bin`, and (on Omarchy) adds a Walker missing, installs the binary to `~/.local/bin`, and (on Omarchy) adds a floating
entry plus the Hyprland rule that makes omagrab float small and centered: Walker entry:
```bash ```bash
curl -fsSL https://raw.githubusercontent.com/28allday/omagrab/main/install.sh | bash curl -fsSL https://raw.githubusercontent.com/28allday/omagrab/main/install.sh | bash
@ -59,8 +70,8 @@ cd omagrab
./install.sh ./install.sh
``` ```
Make sure `~/.local/bin` is on your `PATH`. On Omarchy it also wires up the Make sure `~/.local/bin` is on your `PATH`. The installer prints the optional
`SUPER+SHIFT+V` clipboard keybind (see below). `SUPER+SHIFT+V` clipboard keybind for you to add.
## Usage ## Usage
@ -87,21 +98,27 @@ In the config view: `↑↓` move, `←→` change a value, `Esc` saves and retu
> Single-letter commands (`c`, `d`, `q`) only act when the URL box is empty — so > Single-letter commands (`c`, `d`, `q`) only act when the URL box is empty — so
> they never get swallowed while you're typing or pasting a link. > they never get swallowed while you're typing or pasting a link.
## Clipboard keybind ## Clipboard keybind (recommended)
The smoothest flow on Omarchy: **copy a link → `SUPER+SHIFT+V` → omagrab floats The smoothest flow on Omarchy: copy a link in your browser, then summon omagrab as
with the URL ready → `Tab` to pick mode → `Enter`.** a floating window with the URL already filled in.
The installer sets this up for you — it adds the `SUPER+SHIFT+V` keybind to Add to `~/.config/hypr/bindings.conf`:
`~/.config/hypr/bindings.conf` and the floating window rule to
`~/.config/hypr/windows.conf`, then reloads Hyprland. Both are written between
clearly marked `omagrab` blocks (backed up first, never duplicated on re-run), so
they're easy to find, tweak or remove.
> If `SUPER+SHIFT+V` is already bound to something else, the installer leaves your ```ini
> shortcut alone and prints the line for you to add under a different key. Both the bindd = SUPER SHIFT, V, omagrab, exec, xdg-terminal-exec --app-id=omagrab -e omagrab --clip
> Walker entry and the keybind use the `omagrab` app-id, so the one window rule ```
> covers every launch path — edit its `size` line in `windows.conf` to resize.
And a floating rule in `~/.config/hypr/windows.conf` (Hyprland ≥ 0.55 syntax):
```ini
windowrule = float on, match:class ^(omagrab)$
windowrule = center on, match:class ^(omagrab)$
windowrule = size 520 260, match:class ^(omagrab)$
```
Reload Hyprland (`hyprctl reload`). Now: **copy a link → `SUPER+SHIFT+V`
omagrab floats with the URL ready → `Tab` to pick mode → `Enter`.**
## Configuration ## Configuration

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

View file

@ -107,10 +107,9 @@ install -Dm755 "$TMPBIN" "$BIN"
bold "Installed: $BIN" bold "Installed: $BIN"
# ---- Omarchy desktop integration ----------------------------------------- # ---- Omarchy desktop integration -----------------------------------------
# Only on Omarchy: add a Walker entry that opens omagrab, and a Hyprland window # Only on Omarchy: add a Walker entry that opens omagrab in a floating window.
# rule so it floats small and centered. Both the Walker entry and the optional # The TUI.float app-id is matched by Omarchy's stock floating-window rule, so
# clipboard keybind use the dedicated "omagrab" app-id, so this one rule covers # no Hyprland configuration is required (same approach as tsplay / omarchy-send).
# every launch path.
if command -v omarchy-launch-tui >/dev/null 2>&1 || [ -d "$HOME/.local/share/omarchy" ]; then if command -v omarchy-launch-tui >/dev/null 2>&1 || [ -d "$HOME/.local/share/omarchy" ]; then
mkdir -p "$APP_DIR" mkdir -p "$APP_DIR"
@ -132,7 +131,7 @@ SVG
[Desktop Entry] [Desktop Entry]
Name=omagrab Name=omagrab
Comment=yt-dlp TUI — paste a URL, pick Audio or Video, download Comment=yt-dlp TUI — paste a URL, pick Audio or Video, download
Exec=xdg-terminal-exec --app-id=omagrab -e $BIN Exec=xdg-terminal-exec --app-id=TUI.float -e $BIN
Icon=omagrab Icon=omagrab
Terminal=false Terminal=false
Type=Application Type=Application
@ -142,91 +141,21 @@ EOF
bold "Omarchy detected — added floating Walker entry (with icon)." bold "Omarchy detected — added floating Walker entry (with icon)."
echo " Launch it from Walker by searching 'omagrab'." echo " Launch it from Walker by searching 'omagrab'."
# Omarchy 4+ replaced the sourced ~/.config/hypr/*.conf files with a Lua cat <<EOF
# config chain (~/.config/hypr/hyprland.lua); anything written to the old
# .conf files is silently ignored there. Detect which world we're in and
# write the float rule + clipboard keybind to the file that's actually loaded.
if [ -f "$HOME/.config/hypr/hyprland.lua" ]; then
bindings_lua="$HOME/.config/hypr/bindings.lua"
lua_begin="-- >>> omagrab begin"
lua_end="-- <<< omagrab end"
if [ -f "$bindings_lua" ] && grep -qF "$lua_begin" "$bindings_lua"; then
echo " Hyprland rules + clipboard keybind already present — left as-is."
elif [ -f "$bindings_lua" ] && grep -Eq 'bind\("SUPER \+ SHIFT \+ V"' "$bindings_lua" && ! grep -q omagrab "$bindings_lua"; then
warn " SUPER+SHIFT+V is already bound to something else — skipping the keybind."
echo " To use it anyway, add this to ~/.config/hypr/bindings.lua yourself:"
echo " o.bind(\"SUPER + SHIFT + V\", \"omagrab (clipboard URL)\", \"xdg-terminal-exec --app-id=omagrab -e omagrab --clip\")"
else
mkdir -p "$(dirname "$bindings_lua")"
[ -f "$bindings_lua" ] && cp "$bindings_lua" "$bindings_lua.omagrab-bak"
{
printf '\n%s\n' "$lua_begin"
printf -- '-- omagrab — copy a link, press SUPER+SHIFT+V, omagrab opens with it pre-filled.\n'
printf 'o.window({ class = "^omagrab$" }, { float = true })\n'
printf 'o.window({ class = "^omagrab$" }, { center = true })\n'
printf 'o.window({ class = "^omagrab$" }, { size = { 520, 260 } })\n'
printf 'o.bind("SUPER + SHIFT + V", "omagrab (clipboard URL)", "xdg-terminal-exec --app-id=omagrab -e omagrab --clip")\n'
printf '%s\n' "$lua_end"
} >> "$bindings_lua"
echo " Added floating window rule + SUPER+SHIFT+V keybind to ~/.config/hypr/bindings.lua."
command -v hyprctl >/dev/null 2>&1 && hyprctl reload >/dev/null 2>&1 || true
fi
skip_conf_integration=1
else
skip_conf_integration=0
fi
# Write a small floating window rule, idempotently, between markers we own so Optional: bind clipboard-launch to a key. Copy a link, hit the key, and omagrab
# re-running the installer never duplicates it. Back the file up first. opens with the URL pre-filled. Add to ~/.config/hypr/bindings.conf:
windows_conf="$HOME/.config/hypr/windows.conf"
begin="# >>> omagrab windowrules begin"
end="# <<< omagrab windowrules end"
if [ "$skip_conf_integration" = 1 ]; then
: # Lua config handled above; the .conf files aren't loaded on Omarchy 4+.
elif [ -f "$windows_conf" ] && grep -qF "$begin" "$windows_conf"; then
echo " Hyprland float rule already present — left as-is."
else
mkdir -p "$(dirname "$windows_conf")"
[ -f "$windows_conf" ] && cp "$windows_conf" "$windows_conf.omagrab-bak"
{
printf '\n%s\n' "$begin"
printf '# omagrab — small floating window, centered.\n'
printf 'windowrule = float on, match:class ^(omagrab)$\n'
printf 'windowrule = center on, match:class ^(omagrab)$\n'
printf 'windowrule = size 520 260, match:class ^(omagrab)$\n'
printf '%s\n' "$end"
} >> "$windows_conf"
echo " Added floating window rule to ~/.config/hypr/windows.conf (520x260, centered)."
command -v hyprctl >/dev/null 2>&1 && hyprctl reload >/dev/null 2>&1 || true
fi
# Add the clipboard keybind (SUPER+SHIFT+V), idempotently and backed up. Skip bindd = SUPER SHIFT, V, omagrab, exec, xdg-terminal-exec --app-id=omagrab -e omagrab --clip
# if that combo is already bound to something that isn't us, so we never stomp
# a user's existing shortcut. and a floating rule to ~/.config/hypr/windows.conf (Hyprland >= 0.55):
bindings_conf="$HOME/.config/hypr/bindings.conf"
kb_begin="# >>> omagrab keybind begin" windowrule = float on, match:class ^(omagrab)\$
kb_end="# <<< omagrab keybind end" windowrule = center on, match:class ^(omagrab)\$
keybind_line="bindd = SUPER SHIFT, V, omagrab, exec, xdg-terminal-exec --app-id=omagrab -e omagrab --clip" windowrule = size 520 260, match:class ^(omagrab)\$
if [ "$skip_conf_integration" = 1 ]; then
: # Lua config handled above; the .conf files aren't loaded on Omarchy 4+. then run 'hyprctl reload'.
elif [ -f "$bindings_conf" ] && grep -qF "$kb_begin" "$bindings_conf"; then EOF
echo " Clipboard keybind already present — left as-is."
elif [ -f "$bindings_conf" ] && grep -Eq '^[[:space:]]*bind[a-z]*[[:space:]]*=[[:space:]]*SUPER[[:space:]]+SHIFT[[:space:]]*,[[:space:]]*V[[:space:]]*,' "$bindings_conf"; then
warn " SUPER+SHIFT+V is already bound to something else — skipping the keybind."
echo " To use it anyway, add this line to ~/.config/hypr/bindings.conf yourself:"
echo " $keybind_line"
else
mkdir -p "$(dirname "$bindings_conf")"
[ -f "$bindings_conf" ] && cp "$bindings_conf" "$bindings_conf.omagrab-bak"
{
printf '\n%s\n' "$kb_begin"
printf '# Copy a link, press SUPER+SHIFT+V — omagrab opens with the URL pre-filled.\n'
printf '%s\n' "$keybind_line"
printf '%s\n' "$kb_end"
} >> "$bindings_conf"
echo " Added clipboard keybind: SUPER+SHIFT+V opens omagrab with the copied URL."
command -v hyprctl >/dev/null 2>&1 && hyprctl reload >/dev/null 2>&1 || true
fi
fi fi
case ":$PATH:" in case ":$PATH:" in