~yerinalexey/dotfiles

94e909a90e290c0e9ed7793f3404f7543c5b871e — Alexey Yerin a month ago 62974ba
scripts(*): style updates
M scripts/ce => scripts/ce +1 -1
@@ 4,4 4,4 @@

fd --base-directory "$XDG_CONFIG_HOME" --type=f | \
	fzf --height=80% | \
	xargs -r -I{} "$EDITOR" +"cd $XDG_CONFIG_HOME" "$XDG_CONFIG_HOME/{}"
	xargs -r -I{} "$EDITOR" +"cd $XDG_CONFIG_HOME" "$XDG_CONFIG_HOME"/{}

M scripts/dl-music => scripts/dl-music +4 -4
@@ 2,7 2,7 @@

# Download music from YouTube

MUSIC_DIRECTORY="$HOME/music"
MUSIC_DIRECTORY="$HOME"/music

video_url="$1"



@@ 12,15 12,15 @@ if [ -z "$video_url" ]; then
fi

video_title="$(youtube-dl --get-title "$video_url" | sed 's/\s*\[NCS Release\]\s*//g')"
dest="$MUSIC_DIRECTORY/$video_title"
dest="$MUSIC_DIRECTORY"/"$video_title"

orig="$(youtube-dl --get-filename -f bestaudio -o "$dest.%(ext)s" "$video_url")"
youtube-dl -f bestaudio -o "$dest.%(ext)s" "$video_url"

# Convert to opus
ffmpeg -v 16 -i "$orig" "$dest.opus"
ffmpeg -v 16 -i "$orig" "$dest".opus

# Clean up
rm "$orig"

opus-edit "$dest.opus"
opus-edit "$dest".opus

M scripts/emoji-menu => scripts/emoji-menu +1 -1
@@ 3,7 3,7 @@
# Select and copy an emoji

# Configuration
EMOJI_FILE="$XDG_DATA_HOME/emojis.txt"
EMOJI_FILE="$XDG_DATA_HOME"/emojis.txt

# Generate emoji data if not found
if [ ! -f "$EMOJI_FILE" ]; then

M scripts/pcrond-run => scripts/pcrond-run +1 -1
@@ 4,5 4,5 @@ pidfile=/tmp/pcrond-pid

[ -f "$pidfile" ] && xargs -r kill < "$pidfile"

pcrond -c "$XDG_CONFIG_HOME/pcrond/crontab" >/dev/null 2>/dev/null &
pcrond -c "$XDG_CONFIG_HOME"/pcrond/crontab >/dev/null 2>/dev/null &
printf "%s" $! > "$pidfile"

M scripts/rfcsearch => scripts/rfcsearch +2 -2
@@ 6,6 6,6 @@
PREFIX=/usr
RFCDIR=$PREFIX/share/doc/rfc

tail +70 "$RFCDIR/rfc-index.txt" | \
tail +70 "$RFCDIR"/rfc-index.txt | \
	grep -v "^ " | grep -v "^$" | cut -d"." -f1 | \
	fzf | cut -d" " -f1 | xargs -r -I{} less "$RFCDIR/txt/rfc{}.txt"
	fzf | cut -d" " -f1 | xargs -r -I{} less "$RFCDIR"/txt/rfc{}.txt

M scripts/submit-paste => scripts/submit-paste +1 -1
@@ 4,7 4,7 @@
# CAUTION: very ugly at the bottom

PASTE_BASE="${PASTE_BASE:-https://paste.sr.ht}"
TOKEN="${SRHT_TOKEN:-$(cat "$XDG_CONFIG_HOME/srht-token")}"
TOKEN="${SRHT_TOKEN:-$(cat "$XDG_CONFIG_HOME"/srht-token)}"

usage() {
	cat >&2 <<EOF

M scripts/sync-mail => scripts/sync-mail +4 -4
@@ 16,11 16,11 @@ while getopts q opt; do
	esac
done

INBOX_PATH="$HOME/mail/Inbox"
INBOX_PATH="$HOME"/mail/Inbox

mbsync -c "$XDG_CONFIG_HOME/mbsync/mbsyncrc" -a 2>/dev/null >/dev/null
mbsync -c "$XDG_CONFIG_HOME"/mbsync/mbsyncrc -a 2>/dev/null >/dev/null

count="$(find "$INBOX_PATH/new" -type f | wc -l)"
count="$(find "$INBOX_PATH"/new -type f | wc -l)"

if [ "$count" != "0" ]; then
	[ $quiet -eq 0 ] && notify-send "Mail" "📬 $count new messages!"


@@ 28,5 28,5 @@ if [ "$count" != "0" ]; then
	# Remove messages from new/
	# This will prevent notifications from triggering on the same
	# message twice
	mv "$INBOX_PATH"/new/* "$INBOX_PATH/cur"
	mv "$INBOX_PATH"/new/* "$INBOX_PATH"/cur
fi

M scripts/waybar/weather => scripts/waybar/weather +1 -2
@@ 3,7 3,7 @@
# Module that shows current weather in my city

# Configuration
CACHE_FILE="$XDG_CACHE_HOME/weather"
CACHE_FILE="$XDG_CACHE_HOME"/weather
INTERVAL=3600
CITY=Stavropol



@@ 38,4 38,3 @@ if [ -f "$CACHE_FILE" ]; then
else
	fetch_weather
fi