swaydots

my dotfiles
git clone https://git.awy.one/swaydots.git
Log | Files | Refs | README | LICENSE

commit 11af7ad5623c7d2184759f48abff7b238247b8c3
parent fd0b24659be94880f284f1a63a48cb31d2814018
Author: awy <awy@awy.one>
Date:   Wed, 23 Jul 2025 17:58:33 +0300

rust

Diffstat:
M.local/bin/dmenurecord | 2+-
M.local/bin/randombg | 4++--
M.local/bin/shortcuts | 4++--
M.local/bin/statusbar/sb-battery | 4++--
M.local/bin/statusbar/sb-brightness | 12++++++------
M.local/bin/statusbar/sb-cpubars | 2+-
M.local/bin/statusbar/sb-forecast | 16++++++++--------
M.local/bin/statusbar/sb-internet | 12++++++------
M.local/bin/statusbar/sb-mailbox | 2+-
M.local/bin/statusbar/sb-moonphase | 2+-
M.local/bin/statusbar/sb-news | 2+-
M.local/bin/statusbar/sb-price | 6+++---
M.local/bin/statusbar/sb-ticker | 2+-
M.local/bin/unix | 2+-
14 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord @@ -22,7 +22,7 @@ updateicon() { \ } killrecording() { - recpid="$(cat /tmp/recordingpid)" + recpid="$(bat /tmp/recordingpid)" echo $recpid kill -2 "$recpid" rm -f /tmp/recordingpid diff --git a/.local/bin/randombg b/.local/bin/randombg @@ -2,9 +2,9 @@ killall swaybg PIDFILE="/tmp/randombg.pid" # Check if the PID file exists and if the process is running -if [ -e "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")"; then +if [ -e "$PIDFILE" ] && kill -0 "$(bat "$PIDFILE")"; then echo "Another instance of the script is already running." - kill -9 "$(cat $PIDFILE)" # Forcefully kill the old process + kill -9 "$(bat $PIDFILE)" # Forcefully kill the old process fi echo $$ > "$PIDFILE" trap 'rm -f "$PIDFILE"; exit' INT TERM EXIT diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts @@ -22,7 +22,7 @@ printf "# vim: filetype=sh\\n" > "$shell_env_shortcuts" printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" # Format the `directories` file in the correct syntax and sent it to all three configs. -eval "echo \"$(cat "$bmdirs")\"" | \ +eval "echo \"$(bat "$bmdirs")\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2) >> \"$shell_env_shortcuts\" ; @@ -41,7 +41,7 @@ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"[[mgr.prepend_keymap]]\\non = [\\\"g\\\", %s]\\nrun = \\\"cd %s\\\"\\n\\n\", chars, \$2) >> \"$yazi_shortcuts\" }" # Format the `files` file in the correct syntax and sent it to both configs. -eval "echo \"$(cat "$bmfiles")\"" | \ +eval "echo \"$(bat "$bmfiles")\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2) >> \"$shell_env_shortcuts\" ; diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery @@ -21,7 +21,7 @@ for battery in /sys/class/power_supply/BAT?*; do # If non-first battery, print a space separator. [ -n "${capacity+x}" ] && printf " " # Sets up the status and capacity - case "$(cat "$battery/status" 2>&1)" in + case "$(bat "$battery/status" 2>&1)" in "Full") status="โšก" ;; "Discharging") status="๐Ÿ”‹" ;; "Charging") status="๐Ÿ”Œ" ;; @@ -29,7 +29,7 @@ for battery in /sys/class/power_supply/BAT?*; do "Unknown") status="โ™ป๏ธ" ;; *) exit 1 ;; esac - capacity="$(cat "$battery/capacity" 2>&1)" + capacity="$(bat "$battery/capacity" 2>&1)" # Will make a warn variable if discharging and low [ "$status" = "๐Ÿ”‹" ] && [ "$capacity" -le 25 ] && warn="โ—" # Prints the info diff --git a/.local/bin/statusbar/sb-brightness b/.local/bin/statusbar/sb-brightness @@ -1,21 +1,21 @@ #!/bin/sh # current brightness -curr_brightness=$(cat /sys/class/backlight/*/brightness) +curr_brightness=$(bat /sys/class/backlight/*/brightness) # max_brightness -max_brightness=$(cat /sys/class/backlight/*/max_brightness) +max_brightness=$(bat /sys/class/backlight/*/max_brightness) # brightness percentage brightness_per=$((100 * curr_brightness / max_brightness)) case $BLOCK_BUTTON in - 1) + 1) ;; - 3) - notify-send "๐Ÿ’ก Brightness module" "\- Shows current brightness level โ˜€๏ธ." + 3) + notify-send "๐Ÿ’ก Brightness module" "\- Shows current brightness level โ˜€๏ธ." ;; - 8) + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; esac diff --git a/.local/bin/statusbar/sb-cpubars b/.local/bin/statusbar/sb-cpubars @@ -18,7 +18,7 @@ esac # id total idle stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) [ ! -f $cache ] && echo "$stats" > "$cache" -old=$(cat "$cache") +old=$(bat "$cache") printf "๐Ÿชจ" echo "$stats" | while read -r row; do id=${row%% *} diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast @@ -19,20 +19,20 @@ checkforecast() { getprecipchance() { echo "$weatherdata" | sed '16q;d' | # Extract line 16 from file - rg -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 - 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 + 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")" ;} +readfile() { weatherdata="$(bat "$weatherreport")" ;} showweather() { readfile diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet @@ -19,17 +19,17 @@ case $BLOCK_BUTTON in esac # Wifi -if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then +if [ "$(bat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then wifiicon="$(awk '/^\s*w/ { print "๐Ÿ“ถ", int($3 * 100 / 70) "% " }' /proc/net/wireless)" -elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then - [ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="๐Ÿ“ก " || wifiicon="โŒ " +elif [ "$(bat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then + [ "$(bat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="๐Ÿ“ก " || wifiicon="โŒ " fi # Ethernet -[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="๐ŸŒŽ" || ethericon="โŽ" +[ "$(bat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="๐ŸŒŽ" || ethericon="โŽ" # TUN -[ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon=" ๐Ÿ”’" -[ -n "$(cat /sys/class/net/route*/operstate 2>/dev/null)" ] && tunicon=" ๐Ÿงญ" +[ -n "$(bat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon=" ๐Ÿ”’" +[ -n "$(bat /sys/class/net/route*/operstate 2>/dev/null)" ] && tunicon=" ๐Ÿงญ" printf "%s%s%s\n" "$wifiicon" "$ethericon" "$tunicon" diff --git a/.local/bin/statusbar/sb-mailbox b/.local/bin/statusbar/sb-mailbox @@ -15,7 +15,7 @@ esac 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) +icon=$(bat /tmp/mailupdate 2>/dev/null) if [ "$unread" -eq 0 ]; then [ -n "$icon" ] && echo "๐Ÿ“ฌ$icon" || exit 0 diff --git a/.local/bin/statusbar/sb-moonphase b/.local/bin/statusbar/sb-moonphase @@ -7,7 +7,7 @@ moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase" [ -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;} -icon="$(cat "$moonfile")" +icon="$(bat "$moonfile")" case "$icon" in ๐ŸŒ‘) name="New" ;; diff --git a/.local/bin/statusbar/sb-news b/.local/bin/statusbar/sb-news @@ -14,4 +14,4 @@ case $BLOCK_BUTTON in 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; esac - cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "๐Ÿ“ฐ" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" + bat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "๐Ÿ“ฐ" $1}')$(bat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" diff --git a/.local/bin/statusbar/sb-price b/.local/bin/statusbar/sb-price @@ -41,7 +41,7 @@ case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e less -Srf "$chartfile" >/dev/null ;; 2) notify-send -u low "$icon Updating..." "Updating $name price..." ; updateme="1" ; showupdate="1" ;; 3) uptime="$(date -d "$filestat" '+%D at %T' | sed "s|$(date '+%D')|Today|")" - notify-send "$icon $name module" "\- <b>Exact price: $symb$(cat "$pricefile")</b> + notify-send "$icon $name module" "\- <b>Exact price: $symb$(bat "$pricefile")</b> - Left click for chart of changes. - Middle click to update. - Shows ๐Ÿ”ƒ if updating prices. @@ -54,6 +54,6 @@ esac updateprice "$target" && [ -n "$showupdate" ] && notify-send "$icon Update complete." "$name price is now -$symb$(cat "$pricefile")" +$symb$(bat "$pricefile")" -[ -f "$pricefile" ] && printf "%s%s%0.2f\n" "$icon" "$symb" "$(cat "$pricefile")" +[ -f "$pricefile" ] && printf "%s%s%0.2f\n" "$icon" "$symb" "$(bat "$pricefile")" diff --git a/.local/bin/statusbar/sb-ticker b/.local/bin/statusbar/sb-ticker @@ -15,7 +15,7 @@ url="terminal-stocks.dev" pricefile="${XDG_CACHE_HOME:-$HOME/.cache}/stock-prices" tickerfile="${XDG_CONFIG_HOME:-$HOME/.config}/tickers" -[ -f "$tickerfile" ] && tickers="$(cat "$tickerfile")" || tickers="^GSPC,^DJI,^IXIC"; +[ -f "$tickerfile" ] && tickers="$(bat "$tickerfile")" || tickers="^GSPC,^DJI,^IXIC"; checkprice() { [ -s "$pricefile" ] && [ "$(stat -c %y "$pricefile" 2>/dev/null | diff --git a/.local/bin/unix b/.local/bin/unix @@ -3,7 +3,7 @@ #original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes #converted to shell by #nixers @ irc.unix.chat -cat << 'eof' +bat << 'eof' ,_ ,_==โ–„โ–‚ , โ–‚โ–ƒโ–„โ–„โ–…โ–…โ–…โ–‚โ–…ยพ. / / โ–„โ–†<ยด "ยปโ–“โ–“โ–“%\ / / / /