Compare commits
2 Commits
28f20bc15f
...
9f71ec599d
Author | SHA1 | Date | |
---|---|---|---|
9f71ec599d | |||
95138d0ddf |
@ -1,3 +1,7 @@
|
||||
{{if eq .chezmoi.os "windows" }}
|
||||
shell = "nu"
|
||||
{{end}}
|
||||
|
||||
[window]
|
||||
padding = { x = 8, y = 8 }
|
||||
dimensions = { columns = 160, lines = 120 }
|
||||
|
@ -87,4 +87,4 @@ bind -n C-M-n newpanecurdir
|
||||
|
||||
bind -T copy-mode-vi v send -X begin-selection
|
||||
bind -T copy-mode-vi V send -X select-line
|
||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'cb.sh set'
|
||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'cb set'
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
TMPFILE="$(mktemp)"
|
||||
|
||||
xsel -b > "$TMPFILE"
|
||||
cb > "$TMPFILE"
|
||||
|
||||
newterm() {
|
||||
alacritty msg create-window "$@" ||
|
||||
@ -15,4 +15,4 @@ newterm \
|
||||
-o 'window.opacity = 1.0' \
|
||||
-o 'window.dimensions = { columns = 84, lines = 10 }' \
|
||||
-o 'window.position = { x = 0, y = 1200 }' \
|
||||
-e sh -c "xsel -b > '$TMPFILE'; nvim -c 'set binary noeol textwidth=80' '$TMPFILE' && cat '$TMPFILE' | xsel -ib && rm '$TMPFILE'"
|
||||
-e sh -c "cb > '$TMPFILE'; nvim -c 'set binary noeol textwidth=80' '$TMPFILE' && cat '$TMPFILE' | cb set && rm '$TMPFILE'"
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Copy a bookmark to clipboard.
|
||||
#
|
||||
# Requires fzf, xsel
|
||||
# Bookmarks are stored in ~/dox/not/bk.txt, commented with #
|
||||
# Requires fzf, cb (script in this repo)
|
||||
# Bookmarks are stored in ~/dox/not/bk.txt, commented with ^
|
||||
# -o: print to stdout
|
||||
# -b: open in browser
|
||||
|
||||
@ -26,7 +26,7 @@ if [ "$action" = "stdout" ]; then
|
||||
printf "%s" "$output"
|
||||
fi
|
||||
if [ "$action" = "clip" ]; then
|
||||
printf "%s" "$output" | xsel -ib
|
||||
printf "%s" "$output" | cb set
|
||||
fi
|
||||
if [ "$action" = "browser" ]; then
|
||||
$BROWSER "$output"
|
||||
|
45
src/dot_local/bin/executable_cb
Normal file
45
src/dot_local/bin/executable_cb
Normal file
@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
# cross-platform clipboard wrapper
|
||||
# drop-in replacement for xsel wherever used in my dotfiles
|
||||
|
||||
err () {
|
||||
echo $@ 1>&2
|
||||
}
|
||||
|
||||
no_provider () {
|
||||
err "no providers for clipboard found!"
|
||||
err "supported: termux-api, xsel, wl-clipboard"
|
||||
}
|
||||
|
||||
if [ -z "$1" ] || [ "$1" = "-b" ]; then
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
if command -v wl-paste > /dev/null; then
|
||||
wl-paste
|
||||
fi
|
||||
else
|
||||
if command -v xsel > /dev/null; then
|
||||
xsel -b
|
||||
elif command -v termux-clipboard-set > /dev/null; then
|
||||
termux-clipboard-get
|
||||
else
|
||||
no_provider
|
||||
fi
|
||||
fi
|
||||
elif [ "$1" = "-i" ] || [ "$1" = "set" ]; then
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
if command -v wl-copy > /dev/null; then
|
||||
wl-copy
|
||||
fi
|
||||
else
|
||||
if command -v xsel > /dev/null; then
|
||||
xsel -ib
|
||||
elif command -v termux-clipboard-set > /dev/null; then
|
||||
cat /dev/stdin | termux-clipboard-set
|
||||
else
|
||||
no_provider
|
||||
fi
|
||||
fi
|
||||
else
|
||||
err "usage: cb [-i] [set] [--help]"
|
||||
err "communicates via stdout/stdin."
|
||||
fi
|
@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
# clipboard wrapper
|
||||
|
||||
no_provider () {
|
||||
echo "no providers for clipboard found!"
|
||||
echo "supported: termux-api, xsel, xclip"
|
||||
}
|
||||
|
||||
if [ "$1" = "set" ]; then
|
||||
if command -v xsel > /dev/null; then
|
||||
xsel -ib
|
||||
elif command -v termux-clipboard-set > /dev/null; then
|
||||
cat /dev/stdin | termux-clipboard-set
|
||||
else
|
||||
no_provider
|
||||
fi
|
||||
elif [ "$1" = "get" ]; then
|
||||
if command -v xsel > /dev/null; then
|
||||
xsel -b
|
||||
elif command -v termux-clipboard-set > /dev/null; then
|
||||
termux-clipboard-get
|
||||
else
|
||||
no_provider
|
||||
fi
|
||||
else
|
||||
echo "usage: cb.sh get/set"
|
||||
echo "pipe in data"
|
||||
fi
|
@ -2,7 +2,7 @@
|
||||
# Append link from clipboard/argument to mpv playlist
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
path="$(xsel -b)"
|
||||
path="$(cb)"
|
||||
else
|
||||
path="$2"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user