summaryrefslogtreecommitdiff
path: root/shell-scripts
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-06-30 13:45:31 +0200
committerMike Vink <mike1994vink@gmail.com>2023-06-30 13:45:31 +0200
commitb244546935672b604ab9e46bbb4284638dbef509 (patch)
treeb9ecc30dbd6d681745a4e9f2c713789425809c3d /shell-scripts
parent702cdf6d41bc2bcd3fdad00ba49bb19f7fd36fb6 (diff)
stuff
Diffstat (limited to 'shell-scripts')
-rwxr-xr-xshell-scripts/kakup2
-rw-r--r--shell-scripts/lfub24
-rw-r--r--shell-scripts/mailsync16
-rw-r--r--shell-scripts/transadd9
4 files changed, 42 insertions, 9 deletions
diff --git a/shell-scripts/kakup b/shell-scripts/kakup
index f2f894b..df9b17f 100755
--- a/shell-scripts/kakup
+++ b/shell-scripts/kakup
@@ -29,7 +29,7 @@ session-or-client() {
search() {
if tty -s
then
- fd -d1 "." -t d $HOME $HOME/projects | fzf -1
+ project="$(fd -d1 "." -t d $HOME $HOME/projects | fzf -1)"
else
output=$(mktemp -d /tmp/kakup.XXXXXXXX)/fifo
mkfifo ${output}
diff --git a/shell-scripts/lfub b/shell-scripts/lfub
new file mode 100644
index 0000000..9012f50
--- /dev/null
+++ b/shell-scripts/lfub
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# This is a wrapper script for lb that allows it to create image previews with
+# ueberzug. This works in concert with the lf configuration file and the
+# lf-cleaner script.
+
+set -e
+
+cleanup() {
+ exec 3>&-
+ rm "$FIFO_UEBERZUG"
+}
+
+if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
+ lf "$@"
+else
+ [ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf"
+ export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
+ mkfifo "$FIFO_UEBERZUG"
+ ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
+ exec 3>"$FIFO_UEBERZUG"
+ trap cleanup HUP INT QUIT TERM PWR EXIT
+ lf "$@" 3>&-
+fi
diff --git a/shell-scripts/mailsync b/shell-scripts/mailsync
index 52d1fff..426e5b7 100644
--- a/shell-scripts/mailsync
+++ b/shell-scripts/mailsync
@@ -83,23 +83,23 @@ syncandnotify() {
esac
}
-allchannels="$(grep -hs "Channel" "$MBSYNCRC" "$MPOPRC" | sort -u)"
+allgroups="$(grep -hs "Group" "$MBSYNCRC" "$MPOPRC" | sort -u)"
# Get accounts to sync. All if no argument. Prefix with `error` if non-existent.
IFS='
'
if [ -z "$1" ]; then
- tosync="$allchannels"
+ tosync="$allgroups"
else
- tosync="$(for arg in "$@"; do for availacc in $allchannels; do
- [ "$arg" = "${availacc##* }" ] && echo "$availacc" && break
+ tosync="$(for arg in "$@"; do for grp in $allgroups; do
+ [ "$arg" = "${grp##* }" ] && echo "$grp" && break
done || echo "error $arg"; done)"
fi
-for channel in $tosync; do
- case $channel in
- Channel*) syncandnotify imap "${channel##* }" & ;;
- account*) syncandnotify pop "${channel##* }" & ;;
+for grp in $tosync; do
+ case $grp in
+ Group*) syncandnotify imap "${grp##* }" & ;;
+ account*) syncandnotify pop "${grp##* }" & ;;
error*) echo "ERROR: Account ${channelt##* } not found." ;;
esac
done
diff --git a/shell-scripts/transadd b/shell-scripts/transadd
new file mode 100644
index 0000000..a598fad
--- /dev/null
+++ b/shell-scripts/transadd
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running.
+
+# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep.
+
+pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}")
+
+transmission-remote -a "$@" && notify-send "🔽 Torrent added."