From 3cd9138c9d8fb9be248c75330cca9da47f4d2e8a Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Sun, 10 May 2026 22:57:02 +0200 Subject: added a whole bunch of scripts --- clip-capture | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'clip-capture') diff --git a/clip-capture b/clip-capture index 8bedcda..5184430 100755 --- a/clip-capture +++ b/clip-capture @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -OUTFILE="${OUTFILE:-$HOME/.clips}" +OUTFILE="${OUTFILE:-$HOME/docs/vimwiki/inbox/clips.md}" HAS_NOTIFY=$(command -v notify-send >/dev/null 2>&1 && echo 1 || echo 0) notify() { @@ -17,13 +17,13 @@ die() { get_clipboard() { local out if command -v xclip >/dev/null 2>&1; then - out="$(xclip -o -selection clipboard 2>/dev/null)" - [[ -z "$out" ]] && out="$(xclip -o -selection primary 2>/dev/null)" + out="$(xclip -o -selection primary 2>/dev/null)" + [[ -z "$out" ]] && out="$(xclip -o -selection clipboard 2>/dev/null)" printf '%s' "$out"; return fi if command -v xsel >/dev/null 2>&1; then - out="$(xsel --clipboard --output 2>/dev/null)" - [[ -z "$out" ]] && out="$(xsel --primary --output 2>/dev/null)" + out="$(xsel --primary --output 2>/dev/null)" + [[ -z "$out" ]] && out="$(xsel --clipboard --output 2>/dev/null)" printf '%s' "$out"; return fi die "need xclip or xsel" @@ -34,12 +34,12 @@ clip="$(get_clipboard)" ts="$(date '+%Y-%m-%d %H:%M:%S')" { - printf '# captured %s\n' "$ts" + printf '## captured %s\n' "$ts" printf '%s\n' "$clip" - printf -- '---\n' + printf -- '\n' } >> "$OUTFILE" lines="$(printf '%s\n' "$clip" | wc -l | awk '{print $1}')" chars="${#clip}" -notify normal "capture-clip" "Saved to ~/.clips ($lines lines, $chars chars)" +notify normal "capture-clip" "Saved to vimwiki/inbox/clips.md ($lines lines, $chars chars)" -- cgit v1.3