commit fd0b24659be94880f284f1a63a48cb31d2814018
parent 3378f43e8fb5025435f311e4f7c29a41d79345ac
Author: awy <awy@awy.one>
Date: Wed, 23 Jul 2025 17:47:29 +0300
rust
Diffstat:
24 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/.local/bin/bookmarks b/.local/bin/bookmarks
@@ -37,7 +37,7 @@ update_file() {
}
is_valid_url() {
- printf "%s\n" "${1}" | grep -qE "^https?://[^[:space:]/?#][^[:space:]]+$"
+ printf "%s\n" "${1}" | rg -q "^https?://[^[:space:]/?#][^[:space:]]+$"
}
add_bookmark() {
@@ -45,7 +45,7 @@ add_bookmark() {
is_valid_url "${URL}" || error_notify "The clipboard content is not a valid URL."
- grep -q "=${URL}$" "${URLQUERY_FILE}" &&
+ rg -q "=${URL}$" "${URLQUERY_FILE}" &&
notify-send "The URL is already in the list." && return
NAME="$(printf "" | DMENU "0" "Name")"
@@ -62,7 +62,7 @@ delete_bookmark() {
sed "/^${NAME}=/d" "${URLQUERY_FILE}" > "${URLQUERY_FILE}.tmp"
mv "${URLQUERY_FILE}.tmp" "${URLQUERY_FILE}"
- [ -s "${URLQUERY_FILE}" ] && grep -qE "\S" "${URLQUERY_FILE}" || rm "${URLQUERY_FILE}"
+ [ -s "${URLQUERY_FILE}" ] && rg -q "\S" "${URLQUERY_FILE}" || rm "${URLQUERY_FILE}"
notify-send "'${NAME}' is deleted."
}
@@ -73,7 +73,7 @@ edit_name() {
[ -z "${NEW_NAME}" ] && return
- URL="$(grep "^${OLD_NAME}=" "${URLQUERY_FILE}" | cut -d= -f2)"
+ URL="$(rg "^${OLD_NAME}=" "${URLQUERY_FILE}" | cut -d= -f2)"
update_file "^${OLD_NAME}=" "${NEW_NAME}=${URL}"
}
@@ -103,7 +103,7 @@ edit_bookmark() {
}
open_bookmark() {
- URL="$(grep "^${SELECTION}=" "${URLQUERY_FILE}" | cut -d= -f2-)"
+ URL="$(rg "^${SELECTION}=" "${URLQUERY_FILE}" | cut -d= -f2-)"
[ -z "${URL}" ] && notify-send "Bookmark not found." && exit "1"
diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup
@@ -9,7 +9,7 @@ doas pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
Check your internet connection, if pacman is already running, or run update manually to see errors."
pkill -RTMIN+8 "${STATUSBAR:-i3blocks}"
-if pacman -Qu | grep -v "\[ignored\]"
+if pacman -Qu | rg -v "\[ignored\]"
then
notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (📦) for update."
else
diff --git a/.local/bin/define b/.local/bin/define
@@ -28,8 +28,8 @@ notify-send -t 60000 "$word -" "$def"
# Show all definitions
# def=$(echo "$query" | jq -r '.[].meanings[] | "\n\(.partOfSpeech). \(.definitions[].definition)"')
-# Regex + grep for just definition, if anyone prefers that to jq
-# def=$(grep -Po '"definition":"\K(.*?)(?=")' <<< "$query")
+# Regex + rg for just definition, if anyone prefers that to jq
+# def=$(rg -Po '"definition":"\K(.*?)(?=")' <<< "$query")
# bold=$(tput bold) # Print text bold with echo, for visual clarity
# normal=$(tput sgr0) # Reset text to normal
diff --git a/.local/bin/displayselect b/.local/bin/displayselect
@@ -11,7 +11,7 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
# version for the internal display
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
- internal=$(echo "$screens" | grep -v "$external")
+ internal=$(echo "$screens" | rg -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
tail -n 1 | awk '{print $1}')
@@ -32,7 +32,7 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
else
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
- secondary=$(echo "$screens" | grep -v ^"$primary"$)
+ secondary=$(echo "$screens" | rg -v ^"$primary"$)
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi
@@ -40,10 +40,10 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
morescreen() { # If multi-monitor is selected and there are more than two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
- secondary=$(echo "$screens" | grep -v ^"$primary"$ | dmenu -i -p "Select secondary display:")
+ secondary=$(echo "$screens" | rg -v ^"$primary"$ | dmenu -i -p "Select secondary display:")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
- tertiary=$(echo "$screens" | grep -v ^"$primary"$ | grep -v ^"$secondary"$ | dmenu -i -p "Select third display:")
- xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
+ tertiary=$(echo "$screens" | rg -v ^"$primary"$ | rg -v ^"$secondary"$ | dmenu -i -p "Select third display:")
+ xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | rg -v "$direction")"-of "$primary" --auto
}
multimon() { # Multi-monitor handler.
@@ -53,7 +53,7 @@ multimon() { # Multi-monitor handler.
esac ;}
onescreen() { # If only one output available or chosen.
- xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)
+ xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | rg -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)
}
postrun() { # Stuff to run to clean up.
@@ -62,7 +62,7 @@ postrun() { # Stuff to run to clean up.
}
# Get all possible displays
-allposs=$(xrandr -q | grep "connected")
+allposs=$(xrandr -q | rg "connected")
# Get all connected screens.
screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
diff --git a/.local/bin/dmenumountcifs b/.local/bin/dmenumountcifs
@@ -6,12 +6,12 @@
srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | mew -i -p "Which NAS?") || exit 1
notify-send "Searching for network shares..." "Please wait..."
# Choose share disk...
-share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | mew -i -p "Mount which share?") || exit 1
+share=$(smbclient -L "$srvname" -N | rg Disk | awk '{print $1}' | mew -i -p "Mount which share?") || exit 1
# Format URL...
share2mnt=//"$srvname".local/"$share"
sharemount() {
- mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && doas mkdir /mnt/"$share")
+ mounted=$(mount -v | rg "$share2mnt") || ([ ! -d /mnt/"$share" ] && doas mkdir /mnt/"$share")
[ -z "$mounted" ] && doas mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0
notify-send "Netshare $share already mounted"; exit 1
}
diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord
@@ -10,7 +10,7 @@
# If there is already a running instance, user will be prompted to end it.
getdim() {
- screens=$(swaymsg -t get_outputs | grep name | awk -F'"' '{print $4}')
+ screens=$(swaymsg -t get_outputs --raw | jq -r '.[].name')
choice=$(printf "$screens\nExit\n" | mew)
[ "${choice}" != "Exit" ] || [ -z "${choice}" ] || exit &&
echo $choice
diff --git a/.local/bin/getbib b/.local/bin/getbib
@@ -50,7 +50,7 @@ doi2bib() {
return "1"
}
- grep -iFq "doi = {${doi}}" "${BIB_FILE}" 2> "/dev/null" && {
+ rg -iFq "doi = {${doi}}" "${BIB_FILE}" 2> "/dev/null" && {
printf "%s\n" "Bibtex entry for DOI: ${doi} already exists in the file."
} || {
[ -s "${BIB_FILE}" ] && printf "\n" >> "${BIB_FILE}"
diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler
@@ -13,7 +13,7 @@ else
fi
# Check if the URL is from inv.nadeko.net and adjust it for YouTube
-echo "$url" | grep -q 'inv.nadeko.net/watch'
+echo "$url" | rg -q 'inv.nadeko.net/watch'
if [ $? -eq 0 ]; then
url="https://www.youtube.com/watch?v=$(echo "$url" | sed 's/.*inv\.nadeko\.net\/watch?v=\([^&]*\)/\1/')"
fi
diff --git a/.local/bin/mounter b/.local/bin/mounter
@@ -7,7 +7,7 @@ escape(){ echo "$@" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | t
# Check for phones.
phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/📱/")"
-mountedphones="$(grep "simple-mtpfs" /etc/mtab)"
+mountedphones="$(rg "simple-mtpfs" /etc/mtab)"
# If there are already mounted phones, remove them from the list of mountables.
[ -n "$mountedphones" ] && phones="$(for phone in $phones; do
for mounted in $mountedphones; do
@@ -20,7 +20,7 @@ done)"
# Check for drives.
lsblkoutput="$(lsblk -rpo "uuid,name,type,size,label,mountpoint,fstype")"
# Get all LUKS drives
-allluks="$(echo "$lsblkoutput" | grep crypto_LUKS)"
+allluks="$(echo "$lsblkoutput" | rg crypto_LUKS)"
# Get a list of the LUKS drive UUIDs already decrypted.
decrypted="$(find /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-* | sed "s|.*LUKS2-||;s|-.*||")"
# Functioning for formatting drives correctly for mew:
@@ -37,7 +37,7 @@ unopenedluks="$(for drive in $allluks; do
done | filter)"
# Get all normal, non-encrypted or decrypted partitions that are not mounted.
-normalparts="$(echo "$lsblkoutput"| grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter )"
+normalparts="$(echo "$lsblkoutput"| rg -v crypto_LUKS | rg 'part\|rom\|crypt' | sed "s/^/💾 /" | filter )"
# Add all to one variable. If no mountable drives found, exit.
alldrives="$(echo "$phones
@@ -73,7 +73,7 @@ case "$chosen" in
💾*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
- parttype="$(echo "$lsblkoutput" | grep "$chosen")"
+ parttype="$(echo "$lsblkoutput" | rg "$chosen")"
attemptmount || getmount
case "${parttype##* }" in
vfat) doas_askpass mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;;
diff --git a/.local/bin/noisereduce b/.local/bin/noisereduce
@@ -34,7 +34,7 @@ fi
inBasename=$(basename "$1")
inExt="${inBasename##*.}"
-isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
+isVideoStr=$(ffprobe -v warning -show_streams "$1" | rg codec_type=video)
if [ -n "$isVideoStr" ]
then
isVideo=1
diff --git a/.local/bin/peertubetorrent b/.local/bin/peertubetorrent
@@ -5,5 +5,5 @@
instance=$(echo "$1" | sed "s|/w.\+||")
vidid=$(echo "$1" | sed "s|.\+/||")
-link=$(curl -s "$instance/api/v1/videos/$vidid" | grep -o "$instance/download/torrents/.\{37\}$2.torrent")
+link=$(curl -s "$instance/api/v1/videos/$vidid" | rg -o "$instance/download/torrents/.\{37\}$2.torrent")
transadd "$link"
diff --git a/.local/bin/randombg b/.local/bin/randombg
@@ -9,11 +9,11 @@ fi
echo $$ > "$PIDFILE"
trap 'rm -f "$PIDFILE"; exit' INT TERM EXIT
-swaybg -i $(find /mnt/ssd/papes/. -type f | shuf -n1) -m fill &
+swaybg -i $(fd . /mnt/ssd/papes -t f | shuf -n1) -m fill &
OLD_PID=$!
while true; do
sleep 300
- swaybg -i $(find /mnt/ssd/papes/. -type f | shuf -n1) -m fill &
+ swaybg -i $(fd . /mnt/ssd/papes -t f | shuf -n1) -m fill &
NEXT_PID=$!
sleep 5
kill $OLD_PID
diff --git a/.local/bin/rssadd b/.local/bin/rssadd
@@ -1,17 +1,17 @@
#!/bin/sh
-if echo "$1" | grep -q "https*://\S\+\.[A-Za-z]\+\S*" ; then
+if echo "$1" | rg -q "https*://\S\+\.[A-Za-z]\+\S*" ; then
url="$1"
else
- url="$(grep -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" |
- grep -o "https?://[^\" ]")"
+ url="$(rg -Eom1 '<[^>]+(rel="self"|application/[a-z]+\+xml)[^>]+>' "$1" |
+ rg -o "https?://[^\" ]")"
- echo "$url" | grep -q "https*://\S\+\.[A-Za-z]\+\S*" ||
+ echo "$url" | rg -q "https*://\S\+\.[A-Za-z]\+\S*" ||
notify-send "That doesn't look like a full URL." && exit 1
fi
RSSFILE="${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls"
-if awk '{print $1}' "$RSSFILE" | grep "^$url$" >/dev/null; then
+if awk '{print $1}' "$RSSFILE" | rg "^$url$" >/dev/null; then
notify-send "You already have this RSS feed."
else
echo "$url" >> "$RSSFILE" && notify-send "RSS feed added."
diff --git a/.local/bin/rssget b/.local/bin/rssget
@@ -14,14 +14,14 @@
getlink () {
local url="$1"
- feeds="$(curl -s "$url" | grep -Ex '.*type=.*(rss|rdf|atom).*' | sed 's/ //g')"
+ feeds="$(curl -s "$url" | rg -x '.*type=.*(rss|rdf|atom).*' | sed 's/ //g')"
url="$(echo $url | sed 's|^\(https://[^/]*/\).*|\1|')"
for rsspath in $feeds; do
rsspath="$(echo $rsspath | sed -n "s|.*href=['\"]\([^'\"]*\)['\"].*|\1|p")"
- if echo "$rsspath" | grep "http" > /dev/null; then
+ if echo "$rsspath" | rg "http" > /dev/null; then
link="$rsspath"
- elif echo "$rsspath" | grep -E "^/" > /dev/null; then
+ elif echo "$rsspath" | rg "^/" > /dev/null; then
link="$url$(echo $rsspath | sed 's|^/||')"
else
link="$url$rsspath"
@@ -42,7 +42,7 @@ getYoutubeRss() {
*"/c/"*|*"/user/"*)
feed=$(wget -q "$url" -O tmp_rssget_yt \
&& sed -n 's|.*\("rssUrl":"[^"]*\).*|\1|; p' tmp_rssget_yt \
- | grep rssUrl \
+ | rg rssUrl \
| sed 's|"rssUrl":"||') ;;
esac
echo "$feed"
@@ -50,7 +50,7 @@ getYoutubeRss() {
getVimeoRss() {
local url="$1"
- if echo "$url" | grep -q "/videos$"; then
+ if echo "$url" | rg -q "/videos$"; then
feed_url=$(echo "$url" | sed 's/\/videos$//' | sed 's/\/$/\/rss/')
else
feed_url="${url}/videos/rss"
@@ -60,11 +60,11 @@ getVimeoRss() {
getGithubRss () {
local url="${1%/}"
- if echo $url | grep -E "github.com/[^/]*/[a-zA-Z0-9].*" >/dev/null ; then
+ if echo $url | rg "github.com/[^/]*/[a-zA-Z0-9].*" >/dev/null ; then
echo "${url}/commits.atom"
echo "${url}/releases.atom"
echo "${url}/tags.atom"
- elif echo $url | grep -E "github.com/[^/]*(/)" >/dev/null ; then
+ elif echo $url | rg "github.com/[^/]*(/)" >/dev/null ; then
echo "${url}.atom"
fi
}
@@ -91,19 +91,19 @@ declare -a list=()
yt_regex="^(http(s)?://)?((w){3}\.)?(youtube\.com|invidio\.us|invidious\.flokinet\.to|invidious\.materialio\.us|iv\.datura\.network|invidious\.perennialte\.ch|invidious\.fdn\.fr|invidious\.private\.coffee|invidious\.protokolla\.fi|invidious\.privacyredirect\.com|yt\.artemislena\.eu|yt\.drgnz\.club|invidious\.incogniweb\.net|yewtu\.be|inv\.tux\.pizza|invidious\.reallyaweso\.me|iv\.melmac\.space|inv\.us\.projectsegfau\.lt|inv\.nadeko\.net|invidious\.darkness\.services|invidious\.jing\.rocks|invidious\.privacydev\.net|inv\.in\.projectsegfau\.lt|invidious\.drgns\.space)/(channel|user|c).+"
reddit_regex="^(http(s)?://)?((w){3}\.)?reddit\.com.*"
vimeo_regex="^(http(s)?://)?((w){3}.)?vimeo\.com.*"
-if echo $url | grep -Ex "$yt_regex" >/dev/null ; then
+if echo $url | rg -x "$yt_regex" >/dev/null ; then
list="$(getYoutubeRss "$url")"
-elif echo $url | grep -Ex "$reddit_regex" >/dev/null ; then
+elif echo $url | rg -x "$reddit_regex" >/dev/null ; then
list="$(getRedditRss "$url")"
# vimeo actually works with getlink
-elif echo $url | grep -E "$vimeo_regex" >/dev/null ; then
+elif echo $url | rg "$vimeo_regex" >/dev/null ; then
list="$(getVimeoRss "$url")"
-elif echo $url | grep -E "github.com" >/dev/null ; then
+elif echo $url | rg "github.com" >/dev/null ; then
list="$(getGithubRss "$url")"
# gitlab also works with getlink
-elif echo $url | grep -E "gitlab.com/[a-zA-Z0-9].*" >/dev/null ; then
+elif echo $url | rg "gitlab.com/[a-zA-Z0-9].*" >/dev/null ; then
list="$(getGitlabRss "$url")"
-elif echo $url | grep -E "medium.com/tag" >/dev/null ; then
+elif echo $url | rg "medium.com/tag" >/dev/null ; then
list="$(getMediumRss "$url")"
else
list="$(getlink "$url")"
diff --git a/.local/bin/singboxwrap b/.local/bin/singboxwrap
@@ -16,7 +16,7 @@ run_singbox () {
}
choose_menu () {
- choose="$(find $config_dir -maxdepth 1 -type f | mew -p "Config to use")"
+ choose="$(fd . $config_dir -d 1 -t f | mew -p "Config to use")"
[ -n "$choose" ] || exit 1
ln -sf "$choose" "$default_path"
echo "$default_path"
diff --git a/.local/bin/slider b/.local/bin/slider
@@ -21,12 +21,12 @@ while getopts "hvrpi:c:a:o:d:f:t:e:x:s:" o; do case "${o}" in
s) ppt="$OPTARG" ;;
e) endtime="$OPTARG" ;;
x) res="$OPTARG"
- echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" &&
+ echo "$res" | rg -qv "^[0-9]\+x[0-9]\+$" &&
echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." &&
exit 1 ;;
p) echo "Purge old build files in $cache? [y/N]"
read -r confirm
- echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done."
+ echo "$confirm" | rg -iq "^y$" && rm -rf "$cache" && echo "Done."
exit ;;
v) verbose=True ;;
*) echo "$(basename "$0") usage:
@@ -47,7 +47,7 @@ while getopts "hvrpi:c:a:o:d:f:t:e:x:s:" o; do case "${o}" in
esac done
# Check that the input file looks like it should.
-{ head -n 1 "$file" 2>/dev/null | grep -q "^00:00:00 " ;} || {
+{ head -n 1 "$file" 2>/dev/null | rg -q "^00:00:00 " ;} || {
echo "Give an input file with -i." &&
echo "The file should look as this example:
diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast
@@ -7,7 +7,7 @@ url="${WTTRURL:-wttr.in}"
weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport"
# Get a weather report from 'wttr.in' and save it locally.
-getforecast() { { grep -q -m1 '^up$' /sys/class/net/w*/operstate || grep -q -m1 '^up$' /sys/class/net/e*/operstate; } &&
+getforecast() { { rg -q -m1 '^up$' /sys/class/net/w*/operstate || rg -q -m1 '^up$' /sys/class/net/e*/operstate; } &&
curl -sf "$url/$LOCATION" --output "$weatherreport" && touch "$weatherreport"
}
@@ -19,17 +19,17 @@ checkforecast() {
getprecipchance() {
echo "$weatherdata" | sed '16q;d' | # Extract line 16 from file
- grep -wo "[0-9]*%" | # Find a sequence of digits followed by '%'
- sort -rn | # Sort in descending order
- head -1q # Extract first line
+ rg -wo "[0-9]*%" | # Find a sequence of digits followed by '%'
+ sort -rn | # Sort in descending order
+ head -1q # Extract first line
}
getdailyhighlow() {
echo "$weatherdata" | sed '13q;d' | # Extract line 13 from file
- grep -o "m\\([-+]\\)*[0-9]\\+" | # Find temperatures in the format "m<signed number>"
- sed 's/[+m]//g' | # Remove '+' and 'm'
- sort -g | # Sort in ascending order
- sed -e 1b -e '$!d' # Extract the first and last lines
+ rg -o "m[-+]?[0-9]+" | # Find temperatures in the format "m<signed number>"
+ sed 's/[+m]//g' | # Remove '+' and 'm'
+ sort -g | # Sort in ascending order
+ sed -e 1b -e '$!d' # Extract the first and last lines
}
readfile() { weatherdata="$(cat "$weatherreport")" ;}
diff --git a/.local/bin/statusbar/sb-iplocate b/.local/bin/statusbar/sb-iplocate
@@ -10,6 +10,6 @@ set -e
ifinstalled "geoip"
addr="$(geoiplookup "$(curl -sfm 1 ifconfig.me 2>/dev/null)")"
name="${addr##*, }"
-flag="$(grep "flag: $name" "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji")"
+flag="$(rg "flag: $name" "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji")"
flag="${flag%% *}"
printf "%s %s\\n" "$flag" "$name"
diff --git a/.local/bin/statusbar/sb-kbselect b/.local/bin/statusbar/sb-kbselect
@@ -6,7 +6,7 @@ kbquery()
{
kblayout=$(swaymsg --raw -t get_inputs | jq -r '.[] | select(.type == "keyboard") | .xkb_active_layout_name' | sort -u) || exit 1
kblayout=$(echo "$kblayout" | sed 's/(/\\(/g; s/)/\\)/g') || exit 1
- kblayout=$(grep -oP "^\s*\K\w+(?=\s+$kblayout)" /usr/share/X11/xkb/rules/base.lst) || exit 1
+ kblayout=$(rg -oP "^\s*\K\w+(?=\s+$kblayout)" /usr/share/X11/xkb/rules/base.lst) || exit 1
echo $kblayout
}
diff --git a/.local/bin/statusbar/sb-mailbox b/.local/bin/statusbar/sb-mailbox
@@ -13,7 +13,7 @@ case $BLOCK_BUTTON in
8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;;
esac
-unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
+unread="$(fd . "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/ -t f | wc -l 2>/dev/null)"
icon=$(cat /tmp/mailupdate 2>/dev/null)
diff --git a/.local/bin/statusbar/sb-pacpackages b/.local/bin/statusbar/sb-pacpackages
@@ -26,4 +26,4 @@ case $BLOCK_BUTTON in
8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;;
esac
-pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/📦/;s/^📦0$//g"
+pacman -Qu | rg -Fcv "[ignored]" | sed "s/^/📦/;s/^📦0$//g"
diff --git a/.local/bin/statusbar/sb-ticker b/.local/bin/statusbar/sb-ticker
@@ -23,7 +23,7 @@ checkprice() {
}
getchange() {
- mapfile -t changes < <(sed -e 's/ / /g' "$pricefile" | grep -oe '[m-]\+[0-9]\+\.[0-9]\+' | sed 's/[m ]/;/g')
+ mapfile -t changes < <(sed -e 's/ / /g' "$pricefile" | rg -oe '[m-]\+[0-9]\+\.[0-9]\+' | sed 's/[m ]/;/g')
IFS=',' read -ra TICKER <<< "$tickers"
for idx in "${!TICKER[@]}"; do
printf "%s: %s%%\n" "${TICKER[$idx]}" "${changes[$idx]//;/}"
diff --git a/.local/bin/statusbar/sb-torrent b/.local/bin/statusbar/sb-torrent
@@ -1,6 +1,6 @@
#!/bin/sh
-transmission-remote -l | grep % |
+transmission-remote -l | rg % |
sed " # The letters are for sorting and will not appear.
s/.*Stopped.*/A 🛑/;
s/.*Seeding.*/Z 🌱/;
diff --git a/.local/bin/unmounter b/.local/bin/unmounter
@@ -2,7 +2,7 @@
set -e
-mounteddroids="$(grep simple-mtpfs /etc/mtab | awk '{print "📱" $2}')"
+mounteddroids="$(rg simple-mtpfs /etc/mtab | awk '{print "📱" $2}')"
lsblkoutput="$(lsblk -nrpo "name,type,size,mountpoint")"
mounteddrives="$(echo "$lsblkoutput" | awk '($2=="part"||$2="crypt")&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "💾%s (%s)\n",$4,$3}')"
@@ -18,7 +18,7 @@ doas_askpass umount -l "/${chosen#*/}"
notify-send "Device unmounted." "$chosen has been unmounted."
# Close the chosen drive if decrypted.
-cryptid="$(echo "$lsblkoutput" | grep "/${chosen#*/}$")"
+cryptid="$(echo "$lsblkoutput" | rg "/${chosen#*/}$")"
cryptid="${cryptid%% *}"
test -b /dev/mapper/"${cryptid##*/}"
doas_askpass cryptsetup close "$cryptid"