install: auto-add the SUPER+SHIFT+V clipboard keybind too
The installer now writes both the keybind (bindings.conf) and the float rule (windows.conf) — idempotent, backed up, reloads Hyprland. It skips the keybind (with a printed fallback) if SUPER+SHIFT+V is already bound elsewhere, so it never stomps an existing shortcut. README updated: no manual keybind step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4ce4856134
commit
b3b6605af9
2 changed files with 39 additions and 26 deletions
32
README.md
32
README.md
|
|
@ -59,8 +59,8 @@ cd omagrab
|
|||
./install.sh
|
||||
```
|
||||
|
||||
Make sure `~/.local/bin` is on your `PATH`. The installer also prints an optional
|
||||
`SUPER+SHIFT+V` clipboard keybind for you to add (see below).
|
||||
Make sure `~/.local/bin` is on your `PATH`. On Omarchy it also wires up the
|
||||
`SUPER+SHIFT+V` clipboard keybind (see below).
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
@ -87,25 +87,21 @@ 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
|
||||
> they never get swallowed while you're typing or pasting a link.
|
||||
|
||||
## Clipboard keybind (optional)
|
||||
## Clipboard keybind
|
||||
|
||||
The smoothest flow on Omarchy: copy a link in your browser, then summon omagrab as
|
||||
a floating window with the URL already filled in.
|
||||
The smoothest flow on Omarchy: **copy a link → `SUPER+SHIFT+V` → omagrab floats
|
||||
with the URL ready → `Tab` to pick mode → `Enter`.**
|
||||
|
||||
The installer already added the floating window rule (`omagrab` floats small and
|
||||
centered however it's launched), so all you need is the keybind. Add to
|
||||
`~/.config/hypr/bindings.conf`:
|
||||
The installer sets this up for you — it adds the `SUPER+SHIFT+V` keybind to
|
||||
`~/.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.
|
||||
|
||||
```ini
|
||||
bindd = SUPER SHIFT, V, omagrab, exec, xdg-terminal-exec --app-id=omagrab -e omagrab --clip
|
||||
```
|
||||
|
||||
Reload Hyprland (`hyprctl reload`). Now: **copy a link → `SUPER+SHIFT+V` →
|
||||
omagrab floats with the URL ready → `Tab` to pick mode → `Enter`.**
|
||||
|
||||
> Both the Walker entry and this keybind use the `omagrab` app-id, so the single
|
||||
> window rule the installer wrote to `~/.config/hypr/windows.conf` covers them
|
||||
> both. If you ever want to tweak the size, edit the `windowrule` block there.
|
||||
> If `SUPER+SHIFT+V` is already bound to something else, the installer leaves your
|
||||
> shortcut alone and prints the line for you to add under a different key. Both the
|
||||
> 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.
|
||||
|
||||
## Configuration
|
||||
|
||||
|
|
|
|||
33
install.sh
33
install.sh
|
|
@ -164,14 +164,31 @@ EOF
|
|||
command -v hyprctl >/dev/null 2>&1 && hyprctl reload >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Optional clipboard keybind: copy a link, hit the key, and omagrab opens with the
|
||||
URL pre-filled (it already floats — the rule above covers it). Add to
|
||||
~/.config/hypr/bindings.conf:
|
||||
|
||||
bindd = SUPER SHIFT, V, omagrab, exec, xdg-terminal-exec --app-id=omagrab -e omagrab --clip
|
||||
EOF
|
||||
# Add the clipboard keybind (SUPER+SHIFT+V), idempotently and backed up. Skip
|
||||
# if that combo is already bound to something that isn't us, so we never stomp
|
||||
# a user's existing shortcut.
|
||||
bindings_conf="$HOME/.config/hypr/bindings.conf"
|
||||
kb_begin="# >>> omagrab keybind begin"
|
||||
kb_end="# <<< omagrab keybind end"
|
||||
keybind_line="bindd = SUPER SHIFT, V, omagrab, exec, xdg-terminal-exec --app-id=omagrab -e omagrab --clip"
|
||||
if [ -f "$bindings_conf" ] && grep -qF "$kb_begin" "$bindings_conf"; then
|
||||
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
|
||||
|
||||
case ":$PATH:" in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue