WIP clipboard stupidity and screenshot url update
This commit is contained in:
parent
0e87a22283
commit
de4d852795
1
Makefile
1
Makefile
|
@ -1,5 +1,6 @@
|
|||
MAKEFILE_PATH ?= $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
all: install
|
||||
default: install
|
||||
|
||||
install:
|
||||
|
|
20
bin/clipshot
20
bin/clipshot
|
@ -1,16 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
umask 077
|
||||
d="$(date +"%Y-%m-%d_%H-%M-%S")"
|
||||
fn="$SCROTS_PATH/clipshot_$d.png"
|
||||
|
||||
if is_wayland; then
|
||||
grim -g "$(slurp -d)" - | wl-copy
|
||||
dim="$(slurp -d)"
|
||||
if [ $? -eq 0 ]; then
|
||||
grim -g "$dim" - | wl-copy
|
||||
wl-paste -n > "$fn"
|
||||
echo "$fn"
|
||||
# grim -g "$dim" - | tee "$fn" | wl-copy -f
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
pkill unclutter
|
||||
sleep 0.1
|
||||
fn="$SCROTS_PATH/clipshot_$(date +"%Y-%m-%d_%H-%M-%S").png"
|
||||
import "$fn"
|
||||
chmod 700 "$fn"
|
||||
< "$fn" xclip -t image/png -i -selection clipboard
|
||||
< "$fn" xclip -t image/png -i -selection primary
|
||||
< "$fn" xclip -t image/png -i -selection secondary
|
||||
< "$fn" xclip -t image/png -i -selection buffer-cut
|
||||
unclutter &
|
||||
echo "$fn"
|
||||
fi
|
||||
set -x
|
||||
|
|
15
bin/fzf-history-weight
Executable file
15
bin/fzf-history-weight
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
rf="$1" # history count record file
|
||||
cf="$1" # all choices file
|
||||
|
||||
touch "$record"
|
||||
app="$(
|
||||
< "$rf" awk 'NF{NF--};1' | cat - "$cf" | \
|
||||
sort | uniq -c | sort -nr | \
|
||||
sd '^\s+' '' | \
|
||||
cut -d' ' -f2- | \
|
||||
fzf
|
||||
)"
|
||||
echo "$app $(date +%s)" >> "$LAUNCHER_HISTORY_FILE"
|
||||
echo "$app"
|
8
bin/fzfp
8
bin/fzfp
|
@ -6,7 +6,11 @@ FZFP_PASS_DIR="$HOME/.password-store"
|
|||
FZFP_HEIGHT="${FZFP_HEIGHT:-40%}"
|
||||
FZFP_PROMPT="${FZFP_PROMPT:-"$FZFP_PASS_CMD@$FZFP_PASS_DIR> "}"
|
||||
FZFP_PASS_OPTS="${FZFP_PASS_OPTS:-}"
|
||||
|
||||
cd "$FZFP_PASS_DIR" || { echo "Could not cd to $FZFP_PASS_DIR" >&2; exit 1; }
|
||||
pp="$(fd gpg | sd ".gpg" "" | fzf --height "$FZFP_HEIGHT" --prompt "$FZFP_PROMPT")"
|
||||
"${FZFP_PASS_CMD}" $FZFP_PASS_OPTS "$@" "$pp"
|
||||
|
||||
# TODO: weighted history (see ./launch)
|
||||
"${FZFP_PASS_CMD}" $FZFP_PASS_OPTS "$@" \
|
||||
"$(fd gpg | sd ".gpg" "" | fzf --height "$FZFP_HEIGHT" --prompt "$FZFP_PROMPT")"
|
||||
|
||||
cd - >/dev/null || return 1
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# TODO: can we use fzfp here?
|
||||
floating-term \
|
||||
bash -c "
|
||||
cd $HOME/.password-store
|
||||
fd gpg |
|
||||
sd '.gpg\$' '' |
|
||||
fzf --height 100% --prompt 'fzf-pass> ' > /tmp/fzfp-key
|
||||
pass \"\$(cat /tmp/fzfp-key)\" |
|
||||
head -n 1 |
|
||||
sd '\s+\$' '' |
|
||||
nohup clip &>/dev/null &
|
||||
notify-send -a 'pass' 'Password in Clipboard'
|
||||
"
|
||||
env WAYLAND_DEBUG=1 FZFP_HEIGHT="100%" floating-term bash -c "fzfp | head -n 1 | wl-copy &"
|
||||
|
|
22
bin/scrup
22
bin/scrup
|
@ -1,9 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
f="${HOME}/.scrup.png"
|
||||
set -x
|
||||
|
||||
pkill unclutter
|
||||
sleep 0.1
|
||||
import "${f}"
|
||||
upload "${f}" "scrup-$(date +%Y-%m-%d_%H-%M-%S).png" "scrots"
|
||||
unclutter &
|
||||
remote_dir="scrots"
|
||||
url_prefix="https://files.lyte.dev/$remote_dir"
|
||||
|
||||
u="$(uuid -v4)"
|
||||
d="$(date +%Y-%m-%d_%H-%M-%S)"
|
||||
|
||||
fn="$(clipshot)"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Scrot captured. Uploading..."
|
||||
upload "${fn}" "scrup-$u-$d.png" "$remote_dir"
|
||||
echo "$url_prefix/scrup-$u-$d.png" | clip
|
||||
notify-send "Scrot uploaded. URL in clipboard."
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
|
12
bin/upload
12
bin/upload
|
@ -2,13 +2,13 @@
|
|||
|
||||
# TODO: progress bar!
|
||||
|
||||
HOST="ld"
|
||||
HOST="faceless"
|
||||
|
||||
f="${1}"
|
||||
fname="${2:-$(basename "${f}")}"
|
||||
subdir="${3:-uploads}"
|
||||
internal_dir="/home/daniel/services/data/files/${subdir}"
|
||||
url="https://lyte.dev/${subdir}/${fname}"
|
||||
internal_dir="/home/daniel/files/${subdir}"
|
||||
url="https://files.lyte.dev/${subdir}/${fname}"
|
||||
|
||||
[ "${f}" = "" ] && echo "No file provided. Exiting." >&2 && exit 2
|
||||
[ ! -f "${f}" ] && echo "File '$f' does not exist. Exiting." >&2 && exit 1
|
||||
|
@ -18,11 +18,9 @@ if [ "$(curl -s -o /dev/null -w "%{http_code}" "${url}")" -eq 200 ]; then
|
|||
exit 3
|
||||
fi
|
||||
|
||||
ssh ld mkdir -p "${internal_dir}"
|
||||
rsync --progress --no-owner --no-group --no-perms --stats --ignore-existing "${f}" "${HOST}:${internal_dir}/${fname}" | tee "${HOME}/.upload.log"
|
||||
ssh "$HOST" mkdir -p "${internal_dir}"
|
||||
rsync --progress --no-owner --no-group --chmod=644 --ignore-existing "${f}" "${HOST}:${internal_dir}/${fname}" | tee "${HOME}/.upload.log"
|
||||
code="$?"
|
||||
# shellcheck disable=SC2029
|
||||
ssh ld chmod a+r "${internal_dir}/${fname}"
|
||||
echo "Uploaded to: ${url}"
|
||||
|
||||
if [ "$code" -ne 0 ]; then
|
||||
|
|
|
@ -61,5 +61,5 @@ cd '~/.config/dotfiles' && ./setup.bash # follow the instructions!
|
|||
|
||||
[upstream]: https://git.faceless.lytedev.io/lytedev/dotfiles
|
||||
[github]: https://github.com/lytedev/dotfiles
|
||||
[desktop-screenshot]: https://lyte.dev/unix/desktop-screenshot.png
|
||||
[desktop-screenshot]: https://files.lyte.dev/unix/desktop-screenshot.png
|
||||
[1]: https://smallstep.com/blog/ssh-tricks-and-tips/
|
||||
|
|
Reference in a new issue