commit dd69e40d8299093d1a52c047d05c7c450fc0b268
parent f3e3499ead0f5b9d419fa5b29ff9b1b8445f4b2f
Author: Christos Margiolis <christos@margiolis.net>
Date: Tue, 10 Jan 2023 02:00:48 +0200
bookmark script added
Diffstat:
M | Makefile | | | 1 | + |
A | bookmark | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
M | upd | | | 11 | ++--------- |
M | vds | | | 1 | - |
4 files changed, 58 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
@@ -4,6 +4,7 @@ TARGS = ausplit \
autocomp \
backup \
batnfy \
+ bookmark \
deljail \
doccomp \
docprev \
diff --git a/bookmark b/bookmark
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# XXX: make this an env variable?
+BMK_DIR="${HOME}/shit/bookmarks/"
+
+bmk_getfile()
+{
+ bmkfile="${BMK_DIR}"
+
+ while [ -d ${bmkfile} ]; do
+ bmkfile="$(
+ find ${bmkfile} -maxdepth 1 |
+ dmenu -i -l 10 -p "Choose a file"
+ )" || exit 1
+ done
+ test -f ${bmkfile} || exit 1
+}
+
+bmk_add()
+{
+ local url=$(xclip -o)
+
+ if grep -q "^${url}" ${bmkfile}; then
+ echo "Already bookmarked" | nfy
+ else
+ printf "%s\t%s\n" \
+ "${url}" "$(dmenu -p "Bookmark name" </dev/null)" >> \
+ ${bmkfile}
+ echo "Bookmark added" | nfy
+ fi
+}
+
+bmk_fmt()
+{
+ for i in $(find ${BMK_DIR}); do
+ sed 's/ */\t/' < ${i} | column -ts $'\t' > ${i}.tmp
+ mv -f ${i}.tmp ${i}
+ done
+}
+
+while getopts af arg; do
+case "${arg}" in
+ a) bmk_getfile
+ bmk_add
+ bmk_fmt
+ exit 0 ;;
+ f) bmk_fmt
+ exit 0 ;;
+ *) echo "usage: ${0##*/} [-af]" 1>&2
+ exit 1 ;;
+esac
+done
+
+bmk_getfile
+cat ${bmkfile} | dmenu -i -l 50 | awk '{print $1}' | xargs -r xdotool type
diff --git a/upd b/upd
@@ -2,7 +2,7 @@
# FIXME: trim random symbols
case $1 in
- www) src="${HOME}/src/margiolis.net/"
+ www) src="${HOME}/src/margiolis.net/public/"
dst="master@margiolis.net:/var/www/htdocs/margiolis.net"
;;
ftp) src="${2}"
@@ -17,14 +17,7 @@ case $1 in
desk) src="${2}"
dst="pleb:${3}"
;;
- old) src="${2}"
- dst="old:${3}"
- ;;
- foo) src="${2}"
- dst="foo:${3}"
- ;;
- # add disk, storage, all
- *) echo "usage: ${0##*/} {www | ftp | vps | lap | desk | old | foo} src dst" 1>&2 && exit 1 ;;
+ *) echo "usage: ${0##*/} {www | ftp | vps | lap | desk} src dst" 1>&2 && exit 1 ;;
esac
test -z "${src}" && echo "${0##*/}: src is empty" 1>&2 && exit 1
test -z "${dst}" && echo "${0##*/}: dest is empty" 1>&2 && exit 1
diff --git a/vds b/vds
@@ -1,7 +1,6 @@
#!/bin/sh
PLAYLIST="${HOME}/shit/playlist"
-QUEUE="$(vdq -f)"
while getopts p: arg; do
case "${arg}" in
p) PLAYLIST="${OPTARG}" ;;