summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSam Nystrom <sam@samnystrom.dev>2025-11-27 17:35:42 -0500
committerSam Nystrom <sam@samnystrom.dev>2025-11-27 17:35:42 -0500
commit77b295b8b0f9b73ecbda809e7843812c5f4c3737 (patch)
treebd4dffb07ab4a55e40bd6d6a06e3d0e27dede598 /bin
parentb83a4973d6979c6c05d2a0af2c806d786f346545 (diff)
update
Diffstat (limited to 'bin')
-rwxr-xr-xbin/harespec3
-rwxr-xr-xbin/readmail24
-rwxr-xr-xbin/shuffle19
-rwxr-xr-xbin/statusline4
-rwxr-xr-xbin/wmenu-run2
5 files changed, 32 insertions, 20 deletions
diff --git a/bin/harespec b/bin/harespec
deleted file mode 100755
index 7bfeaf9..0000000
--- a/bin/harespec
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/command/execlineb -P
-importas -i HOME HOME
-zathura ${HOME}/Documents/hare-specification.pdf
diff --git a/bin/readmail b/bin/readmail
index 1643706..5466088 100755
--- a/bin/readmail
+++ b/bin/readmail
@@ -5,15 +5,33 @@ dir=~/mail/"${1:-INBOX}"
while true; do
mlist "$dir" | msort -dr | mseq -S | MBLAZE_PAGER=cat mscan
read -r addr cmd || break
+ if [ -z "$cmd" ]; then
+ cmd="$addr"
+ addr=.
+ fi
case "$cmd" in
- g) mbsync primary >/dev/null 2>&1 && minc ~/mail/* >/dev/null ;;
- c) mseq -C "$addr" ;;
+ g) mbsync primary && minc ~/mail/* >/dev/null ;;
+ C) mseq -C "$addr" ;;
+ c*) dir=~/mail/"${cmd#c}" ;;
s) mshow "$addr" && mflag -S "$addr" >/dev/null ;;
a) mrefile "$addr" ~/mail/Archive ;;
m*) mrefile "$addr" ~/mail/"${cmd#m}" ;;
f*) mflag -"${cmd#f}" "$addr" >/dev/null ;;
+ h)
+ echo 'Commands:'
+ echo 'g - fetch mail'
+ echo 'C - set the sequence to messages'
+ echo 'cFOLDER - cd to FOLDER'
+ echo 's - show messages'
+ echo 'a - archive messages'
+ echo 'mFOLDER - move messages to FOLDER'
+ echo 'fFLAGS - set FLAGS on messages. Uppercase sets, lowercase unsets.'
+ echo ' d=draft, f=flagged, p=passed, r=replied, s=seen, t=trashed.'
+ echo 'h - print this message'
+ echo
+ ;;
q) break ;;
esac
done
echo 'Syncing changes...'
-mbsync primary >/dev/null 2>&1
+mbsync primary
diff --git a/bin/shuffle b/bin/shuffle
index 67c4de9..33f7b95 100755
--- a/bin/shuffle
+++ b/bin/shuffle
@@ -2,9 +2,9 @@
printhelp() {
cat <<EOF
-Usage: ${0##*/} [-v VOL] [DIR]
+Usage: ${0##*/} [-v VOL] [PATHS...]
-Play audio files in DIR (or .) in random order
+Play audio files in PATHS (or .) in random order
-h Print this help
-v VOL Play with volume VOL (default 100)
@@ -13,7 +13,7 @@ EOF
}
printusage() {
- printf 'Usage: %s [-v volume] [path]\n' "${0##*/}"
+ printf 'Usage: %s [-v VOL] [PATHS...]\n' "${0##*/}"
exit 1
}
@@ -22,7 +22,7 @@ while getopts hv: opt; do
case "$opt" in
h) printhelp ;;
v)
- if printf %d "$OPTARG" 2>&1 >/dev/null; then
+ if printf %d "$OPTARG" >/dev/null 2>&1; then
volume="$OPTARG"
else
printf "%s: invalid number '%s'\n" "${0##*/}" "$OPTARG"
@@ -35,18 +35,15 @@ done
shift $((OPTIND-1))
-if [ $# -gt 1 ]; then
- printusage
-elif [ $# -eq 1 ]; then
- dir="$1"
-else
- dir="$(. "${XDG_CONFIG_HOME:-"$HOME"/.config}/user-dirs.dirs" && printf '%s' "$XDG_MUSIC_DIR")"
+if [ $# -lt 1 ]; then
+ # set -- "$(. "${XDG_CONFIG_HOME:-"$HOME"/.config}/user-dirs.dirs" && printf '%s' "$XDG_MUSIC_DIR")"
+ set -- .
fi
prev1=
prev2=
while true; do
- file="$(find -L "$dir" -type f \( -name '*.m4a' -o -name '*.opus' \) ! -path "$prev1" ! -path "$prev2" -exec shuf -n1 -e '{}' +)"
+ file="$(find -L "$@" -type f \( -name '*.m4a' -o -name '*.opus' \) ! -path "$prev1" ! -path "$prev2" -exec shuf -n1 -e '{}' +)"
prev1="$prev2"
prev2="$file"
printf 'Playing %s\n' "${file#$dir/}"
diff --git a/bin/statusline b/bin/statusline
index 948e8cb..b442b91 100755
--- a/bin/statusline
+++ b/bin/statusline
@@ -50,8 +50,8 @@ function battery()
f:close()
local symbol = 'ERROR'
- local i = capacity > 0 and (capacity - 1) // 10 or 0
- if status == 'Discharging\n' then
+ local i = capacity > 0 and (capacity - 1) // 10 + 1 or 1
+ if status == 'Discharging\n' or status == 'Not charging\n' then
symbol = ({"󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"})[i] -- 󰂃
elseif status == 'Charging\n' then
symbol = ({"󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"})[i]
diff --git a/bin/wmenu-run b/bin/wmenu-run
index 84e85f2..6d80a33 100755
--- a/bin/wmenu-run
+++ b/bin/wmenu-run
@@ -1,2 +1,2 @@
#!/bin/sh
-exec $(IFS=:; find -L ${PATH} -type f -perm -555 -exec basename -a '{}' + | wmenu -p run:)
+exec $(IFS=:; find -L ${PATH} -type f -perm -555 -exec basename -a '{}' + | sort -u | wmenu -p run:)