diff options
| author | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-04-14 22:32:43 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-04-14 22:32:43 +0200 |
| commit | 83f7fe4b8402bab171d110703a1b1115efbc9b28 (patch) | |
| tree | 19110702c7d740f6bd8ee4f5d2ebcb97442be237 /bookmarkthis | |
| parent | 51d43498b07dc97d795947964534f0903cd05db5 (diff) | |
| download | bin-83f7fe4b8402bab171d110703a1b1115efbc9b28.tar.gz bin-83f7fe4b8402bab171d110703a1b1115efbc9b28.zip | |
cleaned up many scrits and deleted some that were of no use; renamed a lot
Diffstat (limited to 'bookmarkthis')
| -rwxr-xr-x | bookmarkthis | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/bookmarkthis b/bookmarkthis deleted file mode 100755 index 40f299e..0000000 --- a/bookmarkthis +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -set -eu - -file="$HOME/.snippets" -mkdir -p "$(dirname "$file")" -touch "$file" - -# Choose ONE source: -bookmark="$(xclip -o -selection primary 2>/dev/null || true)" # mouse highlight -# bookmark="$(xclip -o -selection clipboard 2>/dev/null || true)" # Ctrl+C clipboard - -# Strip trailing whitespace/newlines (common when copying) -bookmark="$(printf '%s' "$bookmark" | sed 's/[[:space:]]\+$//')" - -if [ -z "$bookmark" ]; then - notify-send "No string highlighted!" "Please select/copy a string to bookmark" - exit 1 -fi - -# Duplicate check: strip tab-separated comments before comparing -if awk -F'\t' '{print $1}' "$file" | grep -Fxq -- "$bookmark"; then - notify-send "Oops" "Already Bookmarked!" - exit 0 -fi - -# Optionally edit the bookmark text before saving -bookmarkEdit="$(printf '%s' "$bookmark" | dmenu -p "Edit bookmark:")" -out="${bookmarkEdit:-$bookmark}" - -# Optionally add a comment (shown in dmenu search, not pasted) -comment="$(printf '' | dmenu -p "Add comment (optional):")" - -if [ -n "${comment:-}" ]; then - line="$(printf '%s\t# %s' "$out" "$comment")" -else - line="$out" -fi - -printf '%s\n' "$line" >> "$file" -notify-send "Bookmark added!" "$out is now saved to the file" |
