summaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/background-cleanup27
-rwxr-xr-x.local/bin/desktop/dmenu-file-history6
-rwxr-xr-x.local/bin/desktop/dmenu-sound6
-rwxr-xr-x.local/bin/desktop/dmenu-unicode2
-rwxr-xr-x.local/bin/development/envrun55
-rwxr-xr-x.local/bin/development/gi8
-rwxr-xr-x.local/bin/development/gitignore6
-rwxr-xr-x.local/bin/fcode7
-rwxr-xr-x.local/bin/open13
-rwxr-xr-x.local/bin/preview8
-rwxr-xr-x.local/bin/shortcuts20
-rwxr-xr-x.local/bin/shorts/nvc4
-rwxr-xr-x.local/bin/statusbar/i3battery8
-rwxr-xr-x.local/bin/statusbar/i3weather48
-rwxr-xr-x.local/bin/statusbar/sb-clock61
-rwxr-xr-x.local/bin/text-preview23
-rwxr-xr-x.local/bin/web/yth19
-rwxr-xr-x.local/bin/web/ytv13
18 files changed, 258 insertions, 76 deletions
diff --git a/.local/bin/background-cleanup b/.local/bin/background-cleanup
new file mode 100755
index 0000000..c61caec
--- /dev/null
+++ b/.local/bin/background-cleanup
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+[ -z "$CD_HISTFILE" ] &&
+ export CD_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/cd_history"
+
+[ -z "$OPEN_HISTFILE" ] &&
+ export OPEN_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/open_history"
+
+on_ac_power() { [ "$(cat /sys/class/power_supply/ACAD/online)" = 1 ]; }
+
+sleep 10
+on_ac_power || echo "System not plugged to AC Adapter, waiting..."
+
+until on_ac_power; do
+ sleep 10m
+done
+
+echo "[cleanup] Cleaning $CD_HISTFILE"
+cleanup-history-file "$CD_HISTFILE"
+
+echo "[cleanup] Cleaning $OPEN_HISTFILE"
+cleanup-history-file "$OPEN_HISTFILE"
+
+echo "[cleanup] Cleaning orphaned packages..."
+pacman -Qtdq | xargs -r sudo pacman -Rns --noconfirm
+
+echo "[cleanup] Finished Cleaning."
diff --git a/.local/bin/desktop/dmenu-file-history b/.local/bin/desktop/dmenu-file-history
new file mode 100755
index 0000000..0997c76
--- /dev/null
+++ b/.local/bin/desktop/dmenu-file-history
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+[ -n "$OPEN_HISTFILE" ] ||
+ export OPEN_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/open_history"
+
+tac "$OPEN_HISTFILE" | dmenu -i -l 30 | xargs -I{} "${OPENER:-xdg-open}" "{}"
diff --git a/.local/bin/desktop/dmenu-sound b/.local/bin/desktop/dmenu-sound
new file mode 100755
index 0000000..967e9fa
--- /dev/null
+++ b/.local/bin/desktop/dmenu-sound
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+node="$(wpctl status | grep vol: | cut -c5- | dmenu -i -l 30 |
+ sed -E "s/^[ *]*([0-9]{2}).*$/\1/")"
+
+[ -n "$node" ] && wpctl set-default "$node"
diff --git a/.local/bin/desktop/dmenu-unicode b/.local/bin/desktop/dmenu-unicode
index 16e1cfc..5a3a0f5 100755
--- a/.local/bin/desktop/dmenu-unicode
+++ b/.local/bin/desktop/dmenu-unicode
@@ -1,6 +1,6 @@
#!/bin/sh
-chosen=$(cat ~/.local/share/chars/* | dmenu -i -l 25 -fn :size=20)
+chosen=$(cat ~/.local/share/chars/* | dmenu -i -l 25)
[ -z "$chosen" ] && exit
diff --git a/.local/bin/development/envrun b/.local/bin/development/envrun
new file mode 100755
index 0000000..aad0822
--- /dev/null
+++ b/.local/bin/development/envrun
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+help() { echo "envrun - run programs in an isolated home directory
+
+USAGE:
+ envrun [OPTION]... COMMAND
+
+OPTIONS:
+ -d ENVHOME use the ENVHOME environment directory
+ -h show this help message"; }
+
+while getopts 'd:h' o; do case "$o" in
+ d) export ENVHOME="$OPTARG" ;;
+ *) help >&2; exit ;;
+esac done
+shift $((OPTIND - 1))
+
+export HOME="${ENVHOME:-"$PWD"}"
+export XDG_CACHE_HOME="$HOME/.cache"
+export XDG_CONFIG_HOME="$HOME/.config"
+export XDG_DATA_HOME="$HOME/.local/share"
+export XDG_STATE_HOME="$HOME/.local/state"
+
+ensure_dirs() {
+ for dir in "$@"; do
+ [ -d "$dir" ] || { missing=1; break; }
+ done
+
+ [ "$missing" = 1 ] || return
+ printf "\nFollowing directories will be created.\n\n"
+ for dir in "$@"; do
+ [ -d "$dir" ] || echo "$dir/"
+ done
+
+ printf "\ncontinue? [y/N] "
+ read -r ans
+ case "$ans" in
+ y|Y) echo; mkdir -pv "$@"; echo ;;
+ *) exit ;;
+ esac
+}
+
+ensure_dirs \
+ "$XDG_CACHE_HOME" \
+ "$XDG_CONFIG_HOME" \
+ "$XDG_DATA_HOME" \
+ "$XDG_STATE_HOME"
+
+[ "$#" -lt 1 ] && {
+ echo "Please provide a command to run."
+ exit
+}
+
+"$@"
+
diff --git a/.local/bin/development/gi b/.local/bin/development/gi
new file mode 100755
index 0000000..f7884a9
--- /dev/null
+++ b/.local/bin/development/gi
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# gi (git-ignore) - open current repo's gitingore file in $EDITOR
+
+[ -f .gitignore ] && { ${EDITOR:-nvim -p} .gitignore; exit; }
+
+TOPLEVEL="$(git rev-parse --show-toplevel)" || exit
+find "$TOPLEVEL" -name ".gitignore" | xargs -r ${EDITOR:-nvim -p}
diff --git a/.local/bin/development/gitignore b/.local/bin/development/gitignore
deleted file mode 100755
index d78ff99..0000000
--- a/.local/bin/development/gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# gi - edit the Git Ignore file of current repo
-
-TOPLEVEL="$(git rev-parse --show-toplevel)" || exit
-find "$TOPLEVEL" -name ".gitignore" | xargs -r nvim -p
diff --git a/.local/bin/fcode b/.local/bin/fcode
index 073bec4..2c8041d 100755
--- a/.local/bin/fcode
+++ b/.local/bin/fcode
@@ -4,9 +4,8 @@
# place your charecter files in plain text in ~/.local/share/chars/*
if [ "$OPENFLAG" = 0 ]; then
- notify-send fzf-unicode "$*"
chosen="$(printf '%s\n' "$@" | cut -d\ -f1 | tr -d '\n')"
- echo "$chosen" | xclip -selection clipboard
+ printf "%s" "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard."
exit
fi
@@ -16,10 +15,10 @@ fi
mkdir -pv "$FZF_HISTDIR"
export FZF_HIST="$FZF_HISTDIR/unicode_history"
-cut -d ';' -f1 ~/.local/share/chars/* |
+cat ~/.local/share/chars/* |
fzf -m --history="$FZF_HIST" \
--header="Copy Emojis to Clipboard" --header-first \
--preview 'printf "%s\n" {+} | cut -d\ -f1 | tr -d "\n"' \
--preview-window=nohidden,up,1 \
--bind 'ctrl-/:change-preview-window(down|up)' \
- --bind 'enter:execute(echo {q} >> $FZF_HIST; OPENFLAG=0 fzf-unicode {+})'
+ --bind "enter:execute(echo {q} >> \"$FZF_HIST\"; OPENFLAG=0 \"$0\" {+})"
diff --git a/.local/bin/open b/.local/bin/open
index 69dcb9c..dc90c9b 100755
--- a/.local/bin/open
+++ b/.local/bin/open
@@ -1,5 +1,7 @@
#!/bin/sh
+[ -t 1 ] || exec "$TERMINAL" -e open "$@"
+
[ -z "$1" ] && echo "USAGE: open <FILE>" >&2 && exit 1
for file in "$@"; do
@@ -8,15 +10,15 @@ for file in "$@"; do
*.pdf|*.djvu|*.epub) setsid -f zathura "$file" 2>/dev/null ;;
*.png|*.jpg|*.jpeg|*.webp) setsid -f nsxiv "$file" ;;
*.gif|*.mkv|*.mp3|*.mp4|*.webm|*.ogg) ${PLAYER:-mpv --no-config --sub-auto=fuzzy} "$file" ;;
- *.html) ${BROWSER:-w3m} "$file" ;;
+ *.html) ${BROWSER:-w3m --enable-mouse} "$file" ;;
*.pl.txt) fpl "$file" ;;
*.txt|*.description) ${PAGER:-less} "$file" ;;
- *.md) glow --pager --width $(("$(tput cols)" - 5)) "$file" ;;
+ *.md) glow --pager --width $(($(tput cols) - 5)) "$file" ;;
*.css|*.json|*.ipynb|*.vim|*.lua|*.iso|*.zip) LESSOPEN="|preview %s" less -r "$file" ;;
*.srt) fzf-subtitles -o "$file" ;;
*.dig) setsid -f digital "$file" ;;
*.doc|*.docx|*.ppt|*.pptx) setsid -f libreoffice "$file" ;;
- *.sc|*.xls|*.xlsx) sc-im "$file" ;;
+ *.sc|*.xls|*.xlsx) /usr/bin/sc-im "$file" ;;
*.sim1) simulide "$file" ;;
*.xz) ${EDITOR:-nvim} "$file" ;;
@@ -24,7 +26,7 @@ for file in "$@"; do
filetype="$(file --dereference --brief --mime-type "$file")"
case "$filetype" in
inode/directory) ${FILES:-lf} "$file" ; exit ;;
- text/html*) ${BROWSER:-w3m} "$file" ;;
+ text/html*) ${BROWSER:-w3m --enable-mouse} "$file" ;;
*pdf|*djvu|*epub+zip|*oxps|*fictionbook) setsid -f zathura "$file" 2>/dev/null ;;
text/*|*json|*zip|*zstd|*javascript) "${EDITOR:-nvim}" "$file" ;;
application/vnd.openxmlformats-officedocument.*) setsid -f libreoffice "$file" ;;
@@ -42,8 +44,9 @@ for file in "$@"; do
esac
- [ -z "$OPEN_HISTFILE" ] &&
+ [ -n "$OPEN_HISTFILE" ] ||
export OPEN_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/open_history"
+
file="$(realpath "$file")"
sed -i "\|^$file$|d" "$OPEN_HISTFILE"
echo "$file" >> "$OPEN_HISTFILE"
diff --git a/.local/bin/preview b/.local/bin/preview
index 68eec32..5201fcd 100755
--- a/.local/bin/preview
+++ b/.local/bin/preview
@@ -6,8 +6,7 @@ if [ -d "$1" ]; then
else
ls -lhAF --group-directories-first --color=always -- "$1"
fi
- readme="$(find "$1" -maxdepth 1 -name "README.*" | head -1)"
- [ -z "$readme" ] || preview "$readme"
+ find "$1" -maxdepth 1 -iname "README*" | xargs -r preview
exit
fi
@@ -18,8 +17,8 @@ case "$1" in
'') echo "USAGE: preview <FILE>" >&2; exit 1 ;;
*.html) w3m -dump "$1" ;;
*.md) glow "$1" ;;
- # *.vim) highlight --syntax=vim --replace-tabs=2 -- "$1" ;;
- *.js*|*.ts*|*.vim|*.lua) highlight --replace-tabs=2 -- "$1" ;;
+ *.vim) highlight --syntax=vim --replace-tabs=2 -- "$1" ;;
+ *.js*|*.ts*|*.lua) highlight --replace-tabs=2 -- "$1" ;;
*.txt|*.description|*.srt) cat -- "$1" ;;
*.png|*.jpg|*.jpeg|*.webp|*.mp3|*.ogg|*.mp4|*.mkv|*.webm) mediainfo -- "$1" ;;
*.info.json) jq -C . "$1" ;;
@@ -39,7 +38,6 @@ case "$1" in
*odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;;
*.doc) catdoc "$1" ;;
*.docx) docx2txt "$1" - ;;
- # *.csv) sed s/,/\\n/g "$1" ;;
*)
filetype=$(file --dereference --brief --mime-type "$1")
diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts
index 91790e6..368f1ba 100755
--- a/.local/bin/shortcuts
+++ b/.local/bin/shortcuts
@@ -17,13 +17,11 @@ eval "echo \"$(cat "$bmdirs")\"" |
awk -F'\t' "
!/^\s*#/ && !/^\s*$/ {
gsub(\"\\\s*#.*$\", \"\");
- printf(\"C%s='cd %s && ls -A' \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\"
- printf(\"D%s='cd %s && ls -A' \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\"
- printf(\"D%s=\42%s\42 \\\\\n\", \$1, \$2) >> \"$shell_env_shortcuts\"
- printf(\"hash -d D%s=%s\n\", \$1, \$2) >> \"$zsh_named_dirs\"
+ printf(\"%s='cd %s && ls -A' \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\"
+ printf(\"%s=\42%s\42 \\\\\n\", \$1, \$2) >> \"$shell_env_shortcuts\"
+ printf(\"hash -d %s=%s\n\", \$1, \$2) >> \"$zsh_named_dirs\"
printf(\"map C%s :cd %s\n\", \$1, \$2) >> \"$lf_shortcuts\"
- printf(\"cmap ;D%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\"
- printf(\"imap ;D%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\"
+ printf(\"cmap ;%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\"
}
"
@@ -31,12 +29,10 @@ eval "echo \"$(cat "$bmfiles")\"" |
awk -F'\t' "
!/^\s*#/ && !/^\s*$/ {
gsub(\"\\\s*#.*$\", \"\");
- printf(\"E%s='\$EDITOR %s' \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\"
- printf(\"F%s='\$EDITOR %s' \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\"
- printf(\"F%s=\42%s\42 \\\\\n\", \$1, \$2) >> \"$shell_env_shortcuts\"
- printf(\"hash -d F%s=%s\n\", \$1, \$2) >> \"$zsh_named_dirs\"
+ printf(\"%s='\$EDITOR %s' \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\"
+ printf(\"%s=\42%s\42 \\\\\n\", \$1, \$2) >> \"$shell_env_shortcuts\"
+ printf(\"hash -d %s=%s\n\", \$1, \$2) >> \"$zsh_named_dirs\"
printf(\"map E%s $\$EDITOR %s\n\", \$1, \$2) >> \"$lf_shortcuts\"
- printf(\"cmap ;F%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\"
- printf(\"imap ;F%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\"
+ printf(\"cmap ;%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\"
}
"
diff --git a/.local/bin/shorts/nvc b/.local/bin/shorts/nvc
new file mode 100755
index 0000000..0df642d
--- /dev/null
+++ b/.local/bin/shorts/nvc
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# assumes NvChad is configured in ~/Dev/.config/nvim
+envrun -d "$HOME/Dev" nvim "$@"
diff --git a/.local/bin/statusbar/i3battery b/.local/bin/statusbar/i3battery
index 5b2fb15..17a4dfd 100755
--- a/.local/bin/statusbar/i3battery
+++ b/.local/bin/statusbar/i3battery
@@ -47,7 +47,7 @@ for battery in /sys/class/power_supply/BAT?*; do
*) exit 1 ;;
esac
# Will make a warn variable if discharging and low
- [ "$status" = "Discharging" ] && [ "$capacity" -le 25 ] && warn="❗"
+ [ "$status" = "Discharging" ] && [ "$capacity" -lt 30 ] && warn="❗"
# Prints the info
printf "%s%s %d%%" "$warn" "$icon" "$capacity"; unset warn
done && printf "\\n"
@@ -55,11 +55,11 @@ done && printf "\\n"
echo
if [ $capacity -ge 80 ]; then
echo "$BLOCK_COLOR_LEVEL1"
-elif [ $capacity -ge 40 ]; then
+elif [ $capacity -ge 60 ]; then
echo "$BLOCK_COLOR_LEVEL2"
-elif [ $capacity -ge 20 ]; then
+elif [ $capacity -ge 40 ]; then
echo "$BLOCK_COLOR_LEVEL3"
-elif [ $capacity -ge 10 ]; then
+elif [ $capacity -ge 20 ]; then
echo "$BLOCK_COLOR_LEVEL4"
else
echo "$BLOCK_COLOR_LEVEL5"
diff --git a/.local/bin/statusbar/i3weather b/.local/bin/statusbar/i3weather
index c894be6..dec12dd 100755
--- a/.local/bin/statusbar/i3weather
+++ b/.local/bin/statusbar/i3weather
@@ -1,6 +1,6 @@
#!/bin/sh
-# weather module for i3blocks
-# output is set to 'WEATHER UNAVAILABLE' in case wttr.in is unreachable
+# i3blocks weather module using wttr.in
+# output is set to -- in case wttr.in is unreachable
WTTR_CACHE_DIR="/tmp"
WTTR_CACHE="$WTTR_CACHE_DIR/wttr.in"
@@ -8,30 +8,46 @@ WTTR_TXT="$WTTR_CACHE_DIR/wttr.txt"
WTTR_LOCATION="Vasai"
WTTR_URL="https://wttr.in/$WTTR_LOCATION"
+notify() {
+ [ "$isUpdating" = 1 ] &&
+ notify-send --replace-id=217534 "$@"
+}
+
+err() {
+ printf "i3weather: %s\n" "$@" >&2
+ notify "🛑 ERROR (i3weather)" "$*"
+ echo "⛅ -- "
+ exit 1
+}
+
case "$BLOCK_BUTTON" in
'') true ;;
1)
[ -f "$WTTR_CACHE" ] || BLOCK_BUTTON=5 i3weather
- sed 's,\x1B\[[0-9;]*[a-zA-z],,g' "$WTTR_CACHE" > "$WTTR_TXT"
st -c "dropdown_weather" \
- -g "$(wc -L < "$WTTR_TXT")x38" \
- -e less -r "$WTTR_CACHE" & sleep 0.3
- ;;
+ -g "$(wc -L < "$WTTR_TXT")x30" \
+ -e less -r "$WTTR_CACHE" & sleep 0.3 ;;
2) $TERMINAL -e nvim "$0" ;;
- *) notify-send "⛅ Refreshing weather info..." ;;
+ *) isUpdating=1; notify "⛅ Refreshing weather info..." ;;
esac
+# update cache files
+res="$(curl -Ss "$WTTR_URL" > "$WTTR_CACHE" 2>&1)" || err "$res"
+sed 's,\x1B\[[0-9;]*[a-zA-z],,g' "$WTTR_CACHE" > "$WTTR_TXT"
+[ "$(wc -l "$WTTR_TXT" | cut -d' ' -f1)" -lt 20 ] && err "$(cat "$WTTR_TXT")"
+
+# get weather based on argument
case "$1" in
- 1) weather="$(curl -s "$WTTR_URL?format=%c")$WTTR_LOCATION $(curl -Ss "$WTTR_URL?0&T&Q" | sed -E '2,3!d; s/.{16}(.{13}).*/\1/; s/ {4}$//' | tr -d '\n')" ;;
- 2) weather="$(curl -s "$WTTR_URL?format=%c%C")" ;;
- *) weather="$(curl -s "$WTTR_URL?format=%c") $(curl -Ss "$WTTR_URL?0&T&Q" | cut -c 16- | head -2)" ;;
+ info) weather="$(curl -Ss "$WTTR_URL?format=%c%C" 2>&1)" ;;
+ cache) weather="$(sed -E '1,7!d; 3d; 6d; s/.{16}(.{,13}).*/\1/; s/\s//g' "$WTTR_TXT" |
+ sed -z 's/\n/:/; s/\n/ /g; s/\s*$//' 2>&1)" ;;
+ *) weather="$(curl -Ss "$WTTR_URL?format=%l:+%c+%t(%f)++%w++%p" 2>&1)" ;;
esac
-if [ "$(echo "$weather" | grep -Ec "(Unknown|curl|HTML)")" -gt 0 ]; then
- echo "WEATHER UNAVAILABLE"
-else
- echo "${weather:-⛅ -- }"
-fi
+# check for empty responses and errors
+[ "$(echo "$weather" | grep -Ec "(Unknown|curl|HTML)")" -gt 0 ] &&
+ err "$weather" || echo "${weather:-⛅ -- }"
-curl -s "$WTTR_URL" > "$WTTR_CACHE"
+# End response when no error occurs
+notify "✔️ Weather Updated."
diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock
new file mode 100755
index 0000000..d652e92
--- /dev/null
+++ b/.local/bin/statusbar/sb-clock
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+clock=$(date '+%I')
+
+# # emoji icons
+# case "$clock" in
+# "00") icon="🕛" ;;
+# "01") icon="🕐" ;;
+# "02") icon="🕑" ;;
+# "03") icon="🕒" ;;
+# "04") icon="🕓" ;;
+# "05") icon="🕔" ;;
+# "06") icon="🕕" ;;
+# "07") icon="🕖" ;;
+# "08") icon="🕗" ;;
+# "09") icon="🕘" ;;
+# "10") icon="🕙" ;;
+# "11") icon="🕚" ;;
+# "12") icon="🕛" ;;
+# esac
+
+# nerd fonts clock
+case "$clock" in
+ "00") icon="󱑖" ;;
+ "01") icon="󱑋" ;;
+ "02") icon="󱑌" ;;
+ "03") icon="󱑍" ;;
+ "04") icon="󱑎" ;;
+ "05") icon="󱑏" ;;
+ "06") icon="󱑐" ;;
+ "07") icon="󱑑" ;;
+ "08") icon="󱑒" ;;
+ "09") icon="󱑓" ;;
+ "10") icon="󱑔" ;;
+ "11") icon="󱑕" ;;
+ "12") icon="󱑖" ;;
+esac
+
+# # nerd fonts clock filled
+# case "$clock" in
+# "00") icon="󱑊" ;;
+# "01") icon="󱐿" ;;
+# "02") icon="󱑀" ;;
+# "03") icon="󱑁" ;;
+# "04") icon="󱑂" ;;
+# "05") icon="󱑃" ;;
+# "06") icon="󱑄" ;;
+# "07") icon="󱑅" ;;
+# "08") icon="󱑆" ;;
+# "09") icon="󱑇" ;;
+# "10") icon="󱑈" ;;
+# "11") icon="󱑉" ;;
+# "12") icon="󱑊" ;;
+# esac
+
+case $BLOCK_BUTTON in
+ 1) st -c "dropdown_calendar" -g 66x34 -e sh -c "cal -y --color=always|less" ;;
+ 2) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+date +"$icon %H:%M:%S 󰃭 %a %d.%m.%Y ✟ "
diff --git a/.local/bin/text-preview b/.local/bin/text-preview
deleted file mode 100755
index 4d0931d..0000000
--- a/.local/bin/text-preview
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-# A simple text previewer.
-# Useful in certain cases when you don't want to use your glorified previewer
-# and just see the raw text content of a processable document like a markdown
-# file.
-
-[ -f "$1" ] && {
- if command -v highlight >/dev/null; then
- highlight --out-format=ansi -- "$1"
- elif command -v bat >/dev/null; then
- bat -- "$1"
- else
- cat -- "$1"
- fi
- exit
-}
-
-if command -v eza >/dev/null; then
- eza -alhF --group-directories-first --color=always --icons=always -- "$1"
-else
- ls -lhAF --group-directories-first --color=always -- "$1"
-fi
diff --git a/.local/bin/web/yth b/.local/bin/web/yth
new file mode 100755
index 0000000..26cbe91
--- /dev/null
+++ b/.local/bin/web/yth
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+[ -n "$YT_HISTFILE" ] ||
+ export YT_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/yt_history.tsv"
+
+menu() {
+ case "$1" in
+ dmenu) tac "$YT_HISTFILE" | dmenu -l 30 ;;
+ *)
+ bat --color=always --language=tsv --style=plain "$YT_HISTFILE" |
+ fzf --ansi --tac \
+ --delimiter '\t' --with-nth 2,3 \
+ --header-first --header "YT History" \
+ --preview="echo {1}" --preview-window="up,1" \
+ --bind 'ctrl-y:execute-silent(printf "%s\n" {1} | xsel --clipboard)' ;;
+ esac
+}
+
+ menu "$@" | sed -E "s/\t.*\t.*$//"
diff --git a/.local/bin/web/ytv b/.local/bin/web/ytv
index c6e9eec..697c86f 100755
--- a/.local/bin/web/ytv
+++ b/.local/bin/web/ytv
@@ -1,3 +1,16 @@
#!/bin/sh
+case "$(echo "$PWD" | tr '[:upper:]' '[:lower:]')" in
+ *videos*|*movies*|*series*) ;;
+ *)
+ printf "Non standard path for video download, continue? [Y/n] " >&2
+
+ read -r arg
+ case "$arg" in
+ n|N) exit ;;
+ esac
+ echo
+ ;;
+esac
+
yt-dlp "$@" --config ~/.config/yt-dlp/videos.conf