all repos — dotfiles @ 8263eac4ab19879dd3f6fd0fdf16132f40af9d5a

linux dotfiles

add xup scirpt and i3blocks/mail
Prithu Goswami prithugoswami524@gmail.com
Wed, 26 Aug 2020 05:21:58 +0530
commit

8263eac4ab19879dd3f6fd0fdf16132f40af9d5a

parent

756cca9b36f2ebea686d74d47f8c3ae9fd5a5711

2 files changed, 47 insertions(+), 0 deletions(-)

jump to
A bin/scripts/xup

@@ -0,0 +1,34 @@

+#!/bin/bash + +# quick and dirty file sharing script using rsync +# .share folder has to be on the remote machine's +# user's home directory + +remote_hostname="glix" +remote_url="https://x.prithu.xyz" + +slugen () { + # generate a slug of alphabets + dd if=/dev/urandom status=none bs=1024 count=1 | \ + strings | tr -d '[:space:][:punct:][:digit:]' | cut -c -${1:-4} +} + + +if [ "$1" ] +then + if [ -z "$2" ] + then + slug=$(slugen) + if echo "$1" | grep '\.' 2>&1 > /dev/null + then + ext=$(echo "$1" | grep '\.' | cut -d '.' -f2 | sed 's/^/\./') + else + ext="" + fi + rsync "$1" "$remote_hostname:.share/$slug$ext" || exit 1 + echo "$remote_url/$slug$ext" + else + rsync "$1" "$remote_hostname:.share/$2" || exit 1 + echo "$remote_url/$2" + fi +fi
A i3blocks/mail

@@ -0,0 +1,13 @@

+#!/bin/sh + +case $BLOCK_BUTTON in + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" +mailicon=$(echo -en "<span font='Font Awesome 5 Free'>\uf0e0</span>") + +pidof mbsync >/dev/null 2>&1 && icon=$(echo -en "<span font='Font Awesome 5 Free 8'>\uf2f1</span>") + +# [ "$unread" = "0" ] && [ "$icon" = "" ] || echo -e "<span color='#1e82d9'>$mailicon $unread $icon</span>" +[ "$unread" = "0" ] || echo -e "<span color='#1e82d9'>$mailicon $unread $icon</span>"