aboutsummaryrefslogtreecommitdiff
path: root/clip-capture
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-05-10 22:57:02 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-05-10 22:57:02 +0200
commit3cd9138c9d8fb9be248c75330cca9da47f4d2e8a (patch)
treeb3b677a9c1a474589f45d20953028a987fa73b80 /clip-capture
parent83f7fe4b8402bab171d110703a1b1115efbc9b28 (diff)
downloadbin-3cd9138c9d8fb9be248c75330cca9da47f4d2e8a.tar.gz
bin-3cd9138c9d8fb9be248c75330cca9da47f4d2e8a.zip
added a whole bunch of scripts
Diffstat (limited to 'clip-capture')
-rwxr-xr-xclip-capture16
1 files changed, 8 insertions, 8 deletions
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)"