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 /capture-clip | |
| 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 'capture-clip')
| -rwxr-xr-x | capture-clip | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/capture-clip b/capture-clip deleted file mode 100755 index 3bf17f1..0000000 --- a/capture-clip +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -OUTFILE="${OUTFILE:-$HOME/.clips}" - -notify() { - # $1 = urgency (low|normal|critical) - # $2 = title - # $3 = body - if command -v notify-send >/dev/null 2>&1; then - notify-send -u "$1" "$2" "$3" - fi -} - -die() { - notify critical "capture-clip" "$1" - printf -- "ERROR: %s\n" "$1" >&2 - exit 1 -} - -get_clipboard() { - if command -v xclip >/dev/null 2>&1; then - xclip -o -selection clipboard 2>/dev/null || xclip -o -selection primary - return 0 - fi - if command -v xsel >/dev/null 2>&1; then - xsel --clipboard --output 2>/dev/null || xsel --primary --output - return 0 - fi - die "need xclip or xsel" -} - -clip="$(get_clipboard)" - -[[ -n "$clip" ]] || die "clipboard is empty" - -ts="$(date '+%y:%m:%d %H:%M:%S')" - -{ - printf -- "# caputred %s\n" "$ts" - printf -- "%s\n" "$clip" - printf -- "---\n" -} >> "$OUTFILE" - -lines="$(printf "%s" "$clip" | wc -l | tr -d ' ')" -chars="$(printf "%s" "$clip" | wc -c | tr -d ' ')" - -notify normal "capture-clip" "Saved to ~/.clips ($lines lines, $chars chars)" - |
