From b244546935672b604ab9e46bbb4284638dbef509 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Fri, 30 Jun 2023 13:45:31 +0200 Subject: stuff --- shell-scripts/kakup | 2 +- shell-scripts/lfub | 24 ++++++++++++++++++++++++ shell-scripts/mailsync | 16 ++++++++-------- shell-scripts/transadd | 9 +++++++++ 4 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 shell-scripts/lfub create mode 100644 shell-scripts/transadd (limited to 'shell-scripts') 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." -- cgit v1.2.3