summaryrefslogtreecommitdiff
path: root/ar/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'ar/.local/bin')
-rwxr-xr-xar/.local/bin/cron/crontog5
-rwxr-xr-xar/.local/bin/ecrypt2
-rwxr-xr-xar/.local/bin/mounter8
-rwxr-xr-xar/.local/bin/statusbar/sb-clock14
-rwxr-xr-xar/.local/bin/statusbar/sb-ecrypt2
-rwxr-xr-xar/.local/bin/tmuxopen10
6 files changed, 26 insertions, 15 deletions
diff --git a/ar/.local/bin/cron/crontog b/ar/.local/bin/cron/crontog
index ccabe61..68fcd5a 100755
--- a/ar/.local/bin/cron/crontog
+++ b/ar/.local/bin/cron/crontog
@@ -6,7 +6,7 @@
cron_file="${XDG_CONFIG_HOME:-$HOME/.config}/crons"
# Check if there are any active cronjobs
-if crontab -l 2>/dev/null | grep -q '^[^#[:space:]]'; then
+if crontab -l 2>/dev/null | grep -qv '^#\|^$'; then
# If active cronjobs are found, save and disable them
ln -sf "${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}/$(whereami)/.config/crons" "${XDG_CONFIG_HOME:-${HOME}/.config}/crons"
crontab -r
@@ -22,5 +22,8 @@ else
fi
fi
+# Invalidate sb-clock cache so icon updates immediately
+rm -f "${XDG_CACHE_HOME:-${HOME}/.cache}/crontab/cronjobs"
+
# Notify status bar to update
pkill -RTMIN+2 "${STATUSBAR:-dwmblocks}"
diff --git a/ar/.local/bin/ecrypt b/ar/.local/bin/ecrypt
index 4240c71..d16d746 100755
--- a/ar/.local/bin/ecrypt
+++ b/ar/.local/bin/ecrypt
@@ -25,7 +25,7 @@ attempt_mount() {
}
targets="$HOME/.secret"
-mounts="$HOME/Private"
+mounts="$HOME/Secret"
pw="default"
[ -d "$targets" ] || mkdir -p "$targets"
[ -d "$mounts" ] || mkdir -p "$mounts"
diff --git a/ar/.local/bin/mounter b/ar/.local/bin/mounter
index c8eabbf..e62f61b 100755
--- a/ar/.local/bin/mounter
+++ b/ar/.local/bin/mounter
@@ -83,6 +83,13 @@ done | filter)"
# Get all normal, non-encrypted or decrypted partitions that are not mounted.
normalparts="$(echo "$lsblkoutput" | grep -v crypto_LUKS | grep -v 'LVM2_member' | grep -v 'part 1M' | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter)"
+# Get unpartitioned raw disks (disks with no partition children that are not mounted).
+rawdisks="$(echo "$lsblkoutput" | awk '
+ $3=="disk" {disks[$2]=$0}
+ $3=="part" {dev=$2; gsub(/p?[0-9]+$/, "", dev); haspart[dev]=1}
+ END {for (d in disks) if (!(d in haspart)) print disks[d]}
+' | sed "s/^/💾 /" | filter)"
+
# Get all available IP addresses with open Samba shares in the wlan0 subnet, excluding eth0 IP
smbips="$(sudo arp-scan --interface=eth0 --interface=wlan0 --localnet | grep -vEi '(EFM Networks|DUP:)' | awk '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/{print $1}')"
@@ -140,6 +147,7 @@ alldrives="$(echo "$phones
$iphones
$unopenedluks
$normalparts
+$rawdisks
$smbs" | sed "/^$/d;s/ *$//")"
# Quit the script if a sequential command fails.
diff --git a/ar/.local/bin/statusbar/sb-clock b/ar/.local/bin/statusbar/sb-clock
index 6aa1bb4..ddfa28b 100755
--- a/ar/.local/bin/statusbar/sb-clock
+++ b/ar/.local/bin/statusbar/sb-clock
@@ -5,14 +5,14 @@ calendar="🗓"
hour=$(date '+%I')
minute=$(date '+%M')
-# Cache crontab check for 5 minutes
-crontab_cache="${XDG_CACHE_HOME:-${HOME}/.cache}/statusbar/has_crontab"
+# Cache cron daemon check for 5 minutes
+crontab_cache="${XDG_CACHE_HOME:-${HOME}/.cache}/crontab/cronjobs"
if [ ! -f "$crontab_cache" ] || [ $(($(date +%s) - $(stat -c %Y "$crontab_cache" 2>/dev/null || echo 0))) -gt 300 ]; then
- mkdir -p "${XDG_CACHE_HOME:-${HOME}/.cache}/statusbar"
- if crontab -l 2>/dev/null | grep -q '^[^#[:space:]]'; then
- echo "1" > "$crontab_cache"
+ mkdir -p "${XDG_CACHE_HOME:-${HOME}/.cache}/crontab"
+ if crontab -l 2>/dev/null | grep -qv '^#\|^$'; then
+ echo "1" >"$crontab_cache"
else
- echo "0" > "$crontab_cache"
+ echo "0" >"$crontab_cache"
fi
fi
@@ -60,7 +60,7 @@ moonfile="${XDG_DATA_HOME:-${HOME}/.local/share}/wallpapers/moonphase"
# Cache location for 24 hours
if [ ! -s "$locationfile" ] || [ $(($(date +%s) - $(stat -c %Y "$locationfile" 2>/dev/null || echo 0))) -gt 86400 ]; then
mkdir -p "${XDG_CACHE_HOME:-${HOME}/.cache}/statusbar"
- curl -s --max-time 2 http://ip-api.com/json | jq -r '[.regionName, .countryCode] | join(",")' > "$locationfile" 2>/dev/null &
+ curl -s --max-time 2 http://ip-api.com/json | jq -r '[.regionName, .countryCode] | join(",")' >"$locationfile" 2>/dev/null &
fi
location=$(cat "$locationfile" 2>/dev/null || echo "")
diff --git a/ar/.local/bin/statusbar/sb-ecrypt b/ar/.local/bin/statusbar/sb-ecrypt
index f07b994..9ba6e26 100755
--- a/ar/.local/bin/statusbar/sb-ecrypt
+++ b/ar/.local/bin/statusbar/sb-ecrypt
@@ -7,4 +7,4 @@ case $BLOCK_BUTTON in
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
-mount | grep -q "$HOME/Private" && echo "🔑" || echo "🔒"
+mount | grep -q "$HOME/Secret" && echo "🔑" || echo "🔒"
diff --git a/ar/.local/bin/tmuxopen b/ar/.local/bin/tmuxopen
index 5362215..05cdfc8 100755
--- a/ar/.local/bin/tmuxopen
+++ b/ar/.local/bin/tmuxopen
@@ -35,14 +35,14 @@ wrapper() {
echo {q}
)+reload(
rm -f $tmp_files;
- rg --line-number --follow --fixed-strings --hidden --no-heading --color=always --smart-case --glob '!**/.git/**' --glob '!node_modules/**' {q} 2>/dev/null || true
+ rg --line-number --follow --fixed-strings --hidden --no-heading --color=always --smart-case --glob '!**/.git/**' --glob '!**/.github/**' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' --glob '!__pycache__/**' --glob '!target/**' --glob '!.venv/**' --glob '!venv/**' --glob '!coverage/**' --glob '!.next/**' {q} 2>/dev/null || true
)"
file_bind="ctrl-f:transform-query(
current_query={q};
if [ ! -s $tmp_content_query ]; then
echo \$current_query > $tmp_content_query;
fi;
- rg --hidden --follow --files-with-matches --no-messages --glob '!**/.git/**' --glob '!node_modules/**' -- \$current_query > $tmp_files;
+ rg --hidden --follow --files-with-matches --no-messages --glob '!**/.git/**' --glob '!**/.github/**' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' --glob '!__pycache__/**' --glob '!target/**' --glob '!.venv/**' --glob '!venv/**' --glob '!coverage/**' --glob '!.next/**' -- \$current_query > $tmp_files;
)+reload(
if [ -s $tmp_files ]; then
if [ -n {q} ]; then
@@ -59,12 +59,12 @@ wrapper() {
fi
)"
if command -v fd >/dev/null 2>&1; then
- dir_bind="ctrl-d:change-prompt(📁 )+reload(fd --follow --type d --hidden --absolute-path --color never --exclude .git --exclude node_modules --search-path \"\$PWD\")"
+ dir_bind="ctrl-d:change-prompt(📁 )+reload(fd --follow --type d --hidden --absolute-path --color never --exclude .git --exclude .github --exclude node_modules --exclude dist --exclude build --exclude __pycache__ --exclude target --exclude .venv --exclude venv --exclude coverage --exclude .next --search-path \"\$PWD\")"
else
- dir_bind="ctrl-d:change-prompt(📁 )+reload(find \"\$PWD\" -L -type d -name node_modules -prune -o -name .git -prune -o -type d -print)"
+ dir_bind="ctrl-d:change-prompt(📁 )+reload(find \"\$PWD\" -L -type d -name node_modules -prune -o -name .git -prune -o -name .github -prune -o -name dist -prune -o -name build -prune -o -name __pycache__ -prune -o -name target -prune -o -name .venv -prune -o -name venv -prune -o -name coverage -prune -o -name .next -prune -o -type d -print)"
fi
- rg --line-number --follow --no-heading --color=always --smart-case --glob '!**/.git/**' --glob '!LICENSE' '' 2>/dev/null |
+ rg --line-number --follow --no-heading --color=always --smart-case --glob '!**/.git/**' --glob '!**/.github/**' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' --glob '!.next/**' --glob '!__pycache__/**' --glob '!target/**' --glob '!.venv/**' --glob '!venv/**' --glob '!coverage/**' --glob '!LICENSE' '' 2>/dev/null |
fzf-tmux \
--ansi --multi --delimiter : \
--reverse \