1
0
Fork 0

ran shell formatter on scripts

This commit is contained in:
Luca Bilke 2024-01-02 19:09:46 +01:00
parent fe7110f9b4
commit 201d5e9edf
35 changed files with 353 additions and 358 deletions

View file

@ -3,7 +3,7 @@ msgTag="brightness" # Arbitrary but unique message tag
highlight="#7aa2f7"
round() {
awk "BEGIN {printf \"%.0f\", $*}"
awk "BEGIN {printf \"%.0f\", $*}"
}
oldbrightness="$(cat /sys/class/backlight/*/brightness)"
@ -12,22 +12,22 @@ newpercent="$(round "$oldpercent + $1")"
newbrightness="$(round "$newpercent * (255/100)")"
if [ "$newpercent" -gt "100" ]; then
icon="gpm-brightness-lcd"
newpercent=100
newbrightness=255
icon="gpm-brightness-lcd"
newpercent=100
newbrightness=255
elif [ "$newpercent" -gt "50" ]; then
icon="gpm-brightness-lcd"
icon="gpm-brightness-lcd"
elif [ "$newpercent" -gt "0" ]; then
icon="gpm-brightness-lcd-disabled"
icon="gpm-brightness-lcd-disabled"
else
icon="gpm-brightness-lcd-disabled"
newpercent=0
newbrightness=0
icon="gpm-brightness-lcd-disabled"
newpercent=0
newbrightness=0
fi
round $newbrightness | tee /sys/class/backlight/*/brightness
notify-send -a "changeBrightness" -i "$icon" -u low "Brightness: ${newpercent}%" \
-h string:x-dunst-stack-tag:$msgTag \
-h int:value:$newpercent \
-h string:hlcolor:$highlight
-h string:x-dunst-stack-tag:$msgTag \
-h int:value:$newpercent \
-h string:hlcolor:$highlight

View file

@ -16,15 +16,15 @@ ext="${file##*.}"
cd "$dir" || exit 1
textype() {
command="pdflatex"
texroot=$(readlink -f "$(grep -Poi "^ *% *\! *tex root *= *\w+(?:\.\w*)?" "$file" | cut -d "=" -f 2 | tr -d "[:blank:]")")
[ -n "$texroot" ] && base=$texroot && echo "Compiling from TeX root: $texroot"
(head -n5 "$file" | grep -qi 'xelatex') && command="xelatex"
$command --output-directory="$dir" "$base" &&
grep -qi addbibresource "$file" &&
biber --input-directory "$dir" "$base" &&
$command --output-directory="$dir" "$base" &&
$command --output-directory="$dir" "$base"
command="pdflatex"
texroot=$(readlink -f "$(grep -Poi "^ *% *\! *tex root *= *\w+(?:\.\w*)?" "$file" | cut -d "=" -f 2 | tr -d "[:blank:]")")
[ -n "$texroot" ] && base=$texroot && echo "Compiling from TeX root: $texroot"
(head -n5 "$file" | grep -qi 'xelatex') && command="xelatex"
$command --output-directory="$dir" "$base" &&
grep -qi addbibresource "$file" &&
biber --input-directory "$dir" "$base" &&
$command --output-directory="$dir" "$base" &&
$command --output-directory="$dir" "$base"
}
case "$ext" in
@ -35,18 +35,18 @@ cpp) g++ "$file" -o "$base" && "$base" ;;
cs) mcs "$file" && mono "$base".exe ;;
go) go run "$file" ;;
h) sudo make install ;;
# findup is a script available here: https://unix.stackexchange.com/a/35265
# findup is a script available here: https://unix.stackexchange.com/a/35265
java)
loc=$(findup . -name gradlew)
[ "$loc" != "" ] && exec "$loc" run -q -p "$(dirname "$loc")"
;;
loc=$(findup . -name gradlew)
[ "$loc" != "" ] && exec "$loc" run -q -p "$(dirname "$loc")"
;;
m) octave "$file" ;;
md) if [ -x "$(command -v pandoc)" ]; then
pandoc -t latex -s -o "$base".pdf "$file"
pandoc -t latex -s -o "$base".pdf "$file"
elif [ -x "$(command -v groffdown)" ]; then
groffdown -i "$file" | groff -T pdf >"$base.pdf"
groffdown -i "$file" | groff -T pdf >"$base.pdf"
else
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
fi ;;
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf >"$base".pdf ;;
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf >"$base".pdf ;;

View file

@ -1,24 +1,24 @@
#!/bin/sh
askupgrade() {
[ "$(notify-send -c updates --action=Yes=Yes --action=No=No " Repository Sync" "Updates available. Update now?")" = 'Yes' ] && $TERMINAL -e upgrades
[ "$(notify-send -c updates --action=Yes=Yes --action=No=No " Repository Sync" "Updates available. Update now?")" = 'Yes' ] && $TERMINAL -e upgrades
}
if command -v apt 1>/dev/null 2>&1; then
n=$(sudo apt upgrade -dy 2>/dev/null | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9' | cut -c1-2)
if [ "$n" = '' ]; then
notify-send -u critical "Error downloading updates." "Check your internet connection, if apt is already running, or run update manually to see errors."
notify-send -u critical "Error downloading updates." "Check your internet connection, if apt is already running, or run update manually to see errors."
elif [ "$n" != 00 ]; then
askupgrade
askupgrade
fi
elif command -v xbps-install 1>/dev/null 2>&1; then
xbps-install -nuM 1>/tmp/xbps_updates 2>/tmp/xbps_errors
n="$(wc -l < /tmp/xbps_updates)"
ne="$(grep broken /tmp/xbps_errors | wc -l)"
n="$(xbps-install -M -n -u | grep -Fe update -e install | wc -l)"
if [ "$n" != "0" ] && [ "$ne" != "0" ]; then
notify-send -u critical "Error downloading updates." "$(cut -d " " -f 1,5 /tmp/xbps_errors)"
elif [ "$n" -gt 1 ] && [ "$ne" = "0" ]; then
askupgrade
fi
xbps-install -nuM 1>/tmp/xbps_updates 2>/tmp/xbps_errors
n="$(wc -l </tmp/xbps_updates)"
ne="$(grep broken /tmp/xbps_errors | wc -l)"
n="$(xbps-install -M -n -u | grep -Fe update -e install | wc -l)"
if [ "$n" != "0" ] && [ "$ne" != "0" ]; then
notify-send -u critical "Error downloading updates." "$(cut -d " " -f 1,5 /tmp/xbps_errors)"
elif [ "$n" -gt 1 ] && [ "$ne" = "0" ]; then
askupgrade
fi
fi

View file

@ -26,18 +26,18 @@ list_trash_dirs() {
prune() {
[ -w "$1" ] || return 1
for file in "$1"/files/*; do
file=$(basename "$file")
[ "$file" = '*' ] && return
if [ ! -r "$1/info/$file" ] || [ ! "$(head -1 "$1/info/$file")" = "[Trash Info]" ]; then
[ -w "$1/info/$file" ] && rm -rf "$1/info/$file"
rm -rf "$1/files/$file"
continue
fi
if [ "$(date -ud "$days days ago" +%s)" -gt "$(date -ud "$(grep DeletionDate "$1/info/$file" | cut -d '=' -f2)" +%s)" ]; then
echo "$file too old!"
rm -rf "$1/info/$file"
rm -rf "$1/files/$file"
fi
file=$(basename "$file")
[ "$file" = '*' ] && return
if [ ! -r "$1/info/$file" ] || [ ! "$(head -1 "$1/info/$file")" = "[Trash Info]" ]; then
[ -w "$1/info/$file" ] && rm -rf "$1/info/$file"
rm -rf "$1/files/$file"
continue
fi
if [ "$(date -ud "$days days ago" +%s)" -gt "$(date -ud "$(grep DeletionDate "$1/info/$file" | cut -d '=' -f2)" +%s)" ]; then
echo "$file too old!"
rm -rf "$1/info/$file"
rm -rf "$1/files/$file"
fi
done
}

View file

@ -2,6 +2,6 @@
# battery status file is sent in as an argument from sb-battery
upower --monitor-detail -i "$1" | while read -r _; do
pkill -RTMIN+3 dwmblocks
timeout 5 cat >/dev/null
pkill -RTMIN+3 dwmblocks
timeout 5 cat >/dev/null
done

View file

@ -1,4 +1,4 @@
#!/bin/sh
while :; do
( mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks ) || break
(mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks) || break
done

View file

@ -1,4 +1,4 @@
#!/bin/sh
playerctl status -F | while read -r _; do
pkill -RTMIN+11 dwmblocks
pkill -RTMIN+11 dwmblocks
done

View file

@ -6,64 +6,64 @@
twoscreen() { # If multi-monitor is selected and there are two screens.
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
# Mirror displays using native resolution of external display and a scaled
# version for the internal display
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
internal=$(echo "$screens" | grep -v "$external")
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
# Mirror displays using native resolution of external display and a scaled
# version for the internal display
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
internal=$(echo "$screens" | grep -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" |
tail -n 1 | awk '{print $1}')
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" |
tail -n 1 | awk '{print $1}')
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" |
tail -n 1 | awk '{print $1}')
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" |
tail -n 1 | awk '{print $1}')
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
res_ext_y=$(echo "$res_external" | sed 's/.*x//')
res_int_x=$(echo "$res_internal" | sed 's/x.*//')
res_int_y=$(echo "$res_internal" | sed 's/.*x//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
xrandr --output "$external" --auto --scale 1.0x1.0 \
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
xrandr --output "$external" --auto --scale 1.0x1.0 \
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -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
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -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
}
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:")
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
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -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
}
multimon() { # Multi-monitor handler.
case "$(echo "$screens" | wc -l)" in
2) twoscreen ;;
*) morescreen ;;
esac
case "$(echo "$screens" | wc -l)" in
2) twoscreen ;;
*) morescreen ;;
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" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)"
}
postrun() { # Stuff to run to clean up.
setbg # Fix background if screen size/arangement has changed.
remaps # Re-remap keys if keyboard added (for laptop bases)
{
killall dunst
setsid -f dunst
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
setbg # Fix background if screen size/arangement has changed.
remaps # Re-remap keys if keyboard added (for laptop bases)
{
killall dunst
setsid -f dunst
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
}
# Get all possible displays
@ -74,22 +74,22 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
# If there's only one screen
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
{
onescreen "$screens"
postrun
notify-send "💻 Only one screen detected." "Using it in its optimal settings..."
exit
}
{
onescreen "$screens"
postrun
notify-send "💻 Only one screen detected." "Using it in its optimal settings..."
exit
}
# Get user choice including multi-monitor and manual selection:
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
case "$chosen" in
"manual selection")
arandr
exit
;;
"multi-monitor") multimon ;;
*) onescreen "$chosen" ;;
esac
case "$chosen" in
"manual selection")
arandr
exit
;;
"multi-monitor") multimon ;;
*) onescreen "$chosen" ;;
esac
postrun

View file

@ -3,11 +3,11 @@
# this script provides a menu of screenshot options, using flameshot
geom() {
case $1 in
"active") eval "$(xdotool getactivewindow getwindowgeometry --shell)" ;;
"select") eval "$(xdotool selectwindow getwindowgeometry --shell)" ;;
esac
echo "${WIDTH}x${HEIGHT}+${X}+${Y}"
case $1 in
"active") eval "$(xdotool getactivewindow getwindowgeometry --shell)" ;;
"select") eval "$(xdotool selectwindow getwindowgeometry --shell)" ;;
esac
echo "${WIDTH}x${HEIGHT}+${X}+${Y}"
}
# variables

View file

@ -16,9 +16,9 @@ PDF) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathu
sxiv) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
vim) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
setbg)
curl -L "$feed" >"$XDG_CACHE_HOME/pic"
xwallpaper --zoom "$XDG_CACHE_HOME/pic" >/dev/null 2>&1
;;
curl -L "$feed" >"$XDG_CACHE_HOME/pic"
xwallpaper --zoom "$XDG_CACHE_HOME/pic" >/dev/null 2>&1
;;
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
lynx) lynx "$feed" >/dev/null 2>&1 ;;
esac

View file

@ -11,10 +11,10 @@ share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p
share2mnt=//"$srvname".local/"$share"
sharemount() {
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
[ -z "$mounted" ] && sudo 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
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
[ -z "$mounted" ] && sudo 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
}
sharemount

View file

@ -10,108 +10,108 @@
# If there is already a running instance, user will be prompted to end it.
updateicon() {
echo "$1" >/tmp/recordingicon
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
echo "$1" >/tmp/recordingicon
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
}
killrecording() {
recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid"
rm -f /tmp/recordingpid
updateicon ""
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
sleep 3
kill -9 "$recpid"
exit
recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid"
rm -f /tmp/recordingpid
updateicon ""
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
sleep 3
kill -9 "$recpid"
exit
}
screencast() {
ffmpeg -y \
-f x11grab \
-framerate 60 \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-f alsa -i default \
-r 30 \
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
echo $! >/tmp/recordingpid
updateicon "ﲠ"
ffmpeg -y \
-f x11grab \
-framerate 60 \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-f alsa -i default \
-r 30 \
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
echo $! >/tmp/recordingpid
updateicon "ﲠ"
}
video() {
ffmpeg \
-f x11grab \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon "ﲣ"
ffmpeg \
-f x11grab \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon "ﲣ"
}
webcamhidef() {
ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 1920x1080 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon ""
ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 1920x1080 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon ""
}
webcam() {
ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 640x480 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon ""
ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 640x480 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon ""
}
audio() {
ffmpeg \
-f alsa -i default \
-c:a flac \
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! >/tmp/recordingpid
updateicon ""
ffmpeg \
-f alsa -i default \
-c:a flac \
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! >/tmp/recordingpid
updateicon ""
}
askrecording() {
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
case "$choice" in
screencast) screencast ;;
audio) audio ;;
video) video ;;
*selected) videoselected ;;
webcam) webcam ;;
"webcam (hi-def)") webcamhidef ;;
esac
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
case "$choice" in
screencast) screencast ;;
audio) audio ;;
video) video ;;
*selected) videoselected ;;
webcam) webcam ;;
"webcam (hi-def)") webcamhidef ;;
esac
}
asktoend() {
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
[ "$response" = "Yes" ] && killrecording
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
[ "$response" = "Yes" ] && killrecording
}
videoselected() {
slop -f "%x %y %w %h" >/tmp/slop
read -r X Y W H </tmp/slop
rm /tmp/slop
slop -f "%x %y %w %h" >/tmp/slop
read -r X Y W H </tmp/slop
rm /tmp/slop
ffmpeg \
-f x11grab \
-framerate 60 \
-video_size "$W"x"$H" \
-i :0.0+"$X,$Y" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon "ﲣ"
ffmpeg \
-f x11grab \
-framerate 60 \
-video_size "$W"x"$H" \
-i :0.0+"$X,$Y" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon "ﲣ"
}
case "$1" in

View file

@ -5,26 +5,25 @@
# Drives mounted at /, /boot and /home will not be options to unmount.
drives="$(
lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'
awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab
lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'
awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab
)"
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
if case "$chosen" in
*)
chosen="${chosen#📱 }"
sudo -A umount -l "$chosen"
;;
*)
chosen="${chosen% (*}"
sudo -A umount -l "$chosen"
;;
esac
then
notify-send "禍 Drive unmounted." "$chosen successfully unmounted."
*)
chosen="${chosen#📱 }"
sudo -A umount -l "$chosen"
;;
*)
chosen="${chosen% (*}"
sudo -A umount -l "$chosen"
;;
esac then
notify-send "禍 Drive unmounted." "$chosen successfully unmounted."
else
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
fi
sudo -A umount "$chosen" && notify-send "禍 USB unmounting" "$chosen unmounted."

View file

@ -11,8 +11,8 @@ chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | dmenu -i -l 30 | sed "s/ .*//")
# If you run this command with an argument, it will automatically insert the
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
xdotool type "$chosen"
xdotool type "$chosen"
else
printf "%s" "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &
printf "%s" "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &
fi

View file

@ -6,9 +6,9 @@ BLUE='\033[34m'
RED='\033[31m'
NC='\033[0m'
dgit(){
# shellcheck disable=SC2068
git -C "$STOW_DIR/$DOTS_PACKAGE" $@
dgit() {
# shellcheck disable=SC2068
git -C "$STOW_DIR/$DOTS_PACKAGE" $@
}
printf "%b" "${BOLD}${BLUE}Removing dotfile symlinks...$NC\n\n"
@ -18,7 +18,7 @@ printf "%b" "${BOLD}${BLUE}Stashing existing changes...$NC\n"
stash_result=$(dgit stash push)
needs_pop=1
if [ "$stash_result" = "No local changes to save" ]; then
needs_pop=0
needs_pop=0
fi
printf "\n"
@ -29,17 +29,17 @@ dgit submodule update --remote --merge
printf "\n"
if [ $needs_pop -eq 1 ]; then
printf "%b" "${BOLD}${BLUE}Popping stashed changes...$NC\n"
dgit stash pop
printf "%b" "${BOLD}${BLUE}Popping stashed changes...$NC\n"
dgit stash pop
fi
printf "\n"
unmerged_files=$(dgit diff --name-only --diff-filter=U)
if [ -n "$unmerged_files" ]; then
printf "%b" "${RED}The following files have merge conflicts after popping the stash:$NC\n\n"
printf "%s" "$unmerged_files\n\n"
printf "%s" "${BOLD}${BLUE}Reverting to previous commit...$NC"
dgit checkout "$old_commit"
printf "%b" "${RED}The following files have merge conflicts after popping the stash:$NC\n\n"
printf "%s" "$unmerged_files\n\n"
printf "%s" "${BOLD}${BLUE}Reverting to previous commit...$NC"
dgit checkout "$old_commit"
fi
printf "%b" "${BOLD}${BLUE}Symlinking dotfiles...$NC\n\n"

View file

@ -3,7 +3,7 @@ set -e
path="$1"
shift 1
while [[ $path != / ]]; do
find "$path" -maxdepth 1 -mindepth 1 "$@"
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
path="$(readlink -f "$path"/..)"
find "$path" -maxdepth 1 -mindepth 1 "$@"
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
path="$(readlink -f "$path"/..)"
done

View file

@ -3,7 +3,7 @@
# Reads file names from stdin and selects them in lf.
while read -r file; do
[ -z "$file" ] && continue
lf -remote "send select \"$file\""
lf -remote "send toggle"
[ -z "$file" ] && continue
lf -remote "send select \"$file\""
lf -remote "send toggle"
done

View file

@ -2,20 +2,19 @@
set -e
clean () {
exec 3>&-
rm "$FIFO_UEBERZUG"
clean() {
exec 3>&-
rm "$FIFO_UEBERZUG"
}
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
command lf "$@"
command lf "$@"
else
[ ! -d "$XDG_CACHE_HOME/lf" ] && mkdir --parents "$XDG_CACHE_HOME/lf"
export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
[ ! -d "$XDG_CACHE_HOME/lf" ] && mkdir --parents "$XDG_CACHE_HOME/lf"
export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
mkfifo "$FIFO_UEBERZUG"
ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
exec 3>"$FIFO_UEBERZUG"
trap clean HUP INT QUIT TERM PWR EXIT
command lf "$@" 3>&-
ueberzug layer -s -p json <"$FIFO_UEBERZUG" &
exec 3>"$FIFO_UEBERZUG"
trap clean HUP INT QUIT TERM PWR EXIT
command lf "$@" 3>&-
fi

View file

@ -7,25 +7,25 @@
# otherwise it opens link in browser.
if [ -z "$1" ]; then
url="$(xclip -o)"
url="$(xclip -o)"
else
url="$1"
url="$1"
fi
case "$url" in
*mkv | *webm | *mp4 | *youtube.com/watch* | *youtube.com/playlist* | *youtube.com/shorts* | *youtu.be* | *hooktube.com* | *bitchute.com* | *videos.lukesmith.xyz* | *odysee.com*)
setsid -f mpv -quiet "$url" >/dev/null 2>&1
;;
setsid -f mpv -quiet "$url" >/dev/null 2>&1
;;
*png | *jpg | *jpe | *jpeg | *gif)
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
;;
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
;;
*pdf | *cbz | *cbr)
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
;;
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
;;
*mp3 | *flac | *opus | *mp3?source*)
qndl "$url" 'curl -LO' >/dev/null 2>&1
;;
qndl "$url" 'curl -LO' >/dev/null 2>&1
;;
*)
[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
;;
[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
;;
esac

View file

@ -9,7 +9,7 @@
IFS='
'
# Function for escaping cell-phone names.
escape(){ echo "$@" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g" ;}
escape() { echo "$@" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g"; }
# Check for phones.
phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/📱/")"
@ -30,12 +30,12 @@ allluks="$(echo "$lsblkoutput" | grep 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 dmenu:
filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6}' ; }
filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6}'; }
# Get only LUKS drives that are not decrypted.
unopenedluks="$(for drive in $allluks; do
uuid="${drive%% *}"
uuid="${uuid//-}" # This is a bashism.
uuid="${uuid//-/}" # This is a bashism.
[ -n "$decrypted" ] && for open in $decrypted; do
[ "$uuid" = "$open" ] && break 1
done && continue 1
@ -43,7 +43,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" | grep -v crypto_LUKS | grep 'part\|rom\|crypt' | sed "s/^/💾 /" | filter)"
# Add all to one variable. If no mountable drives found, exit.
alldrives="$(echo "$phones
@ -59,7 +59,7 @@ test -n "$alldrives"
chosen="$(echo "$alldrives" | dmenu -p "Mount which drive?" -i)"
# Function for prompting user for a mountpoint.
getmount(){
getmount() {
mp="$(find /mnt /media /mount /home -maxdepth 1 -type d 2>/dev/null | dmenu -i -p "Mount this drive where?")"
test -n "$mp"
if [ ! -d "$mp" ]; then
@ -68,47 +68,47 @@ getmount(){
fi
}
attemptmount(){
# Attempt to mount without a mountpoint, to see if drive is in fstab.
sudo -A mount "$chosen" || return 1
notify-send "💾Drive Mounted." "$chosen mounted."
exit
attemptmount() {
# Attempt to mount without a mountpoint, to see if drive is in fstab.
sudo -A mount "$chosen" || return 1
notify-send "💾Drive Mounted." "$chosen mounted."
exit
}
case "$chosen" in
💾*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
attemptmount || getmount
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send "💾Drive Mounted." "$chosen mounted to $mp."
;;
💾*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
attemptmount || getmount
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send "💾Drive Mounted." "$chosen mounted to $mp."
;;
🔒*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num +1))")"
done
🔒*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num + 1))")"
done
# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"
# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"
attemptmount || getmount
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send "🔓Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
;;
attemptmount || getmount
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send "🔓Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
;;
📱*)
notify-send "❗Note" "Remember to allow file access on your phone now."
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send "🤖 Android Mounted." "Android device mounted to $mp."
;;
📱*)
notify-send "❗Note" "Remember to allow file access on your phone now."
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send "🤖 Android Mounted." "Android device mounted to $mp."
;;
esac

View file

@ -3,15 +3,15 @@ RED=$(printf "\e[1;31m")
NORMAL=$(printf "\e[0m")
colors1() {
for i in 0 1 2 3 4 5 6 7; do
printf "%b" "\e[4${i}m \e[0m"
done
for i in 0 1 2 3 4 5 6 7; do
printf "%b" "\e[4${i}m \e[0m"
done
}
colors2() {
for i in 0 1 2 3 4 5 6 7; do
printf "%b" "\e[10${i}m \e[0m"
done
for i in 0 1 2 3 4 5 6 7; do
printf "%b" "\e[10${i}m \e[0m"
done
}
cat <<EOF

View file

@ -7,20 +7,20 @@ volume="$(pamixer --get-volume)"
mute="$(pamixer --get-mute)"
[ "$volume" -gt "100" ] &&
highlight="#ff768e" ||
highlight="#7aa2f7"
highlight="#ff768e" ||
highlight="#7aa2f7"
if [ "$mute" = "true" ]; then
icon="audio-volume-muted"
icon="audio-volume-muted"
elif [ "$volume" -gt "70" ]; then
icon="audio-volume-high"
icon="audio-volume-high"
elif [ "$volume" -gt "30" ]; then
icon="audio-volume-medium"
icon="audio-volume-medium"
elif [ "$volume" -ge "0" ]; then
icon="audio-volume-low"
icon="audio-volume-low"
fi
notify-send -a "changeVolume" -i "$icon" -u low "Volume: ${volume}%" \
-h string:x-dunst-stack-tag:$msgTag \
-h int:value:$volume \
-h string:hlcolor:$highlight
-h string:x-dunst-stack-tag:$msgTag \
-h int:value:$volume \
-h string:hlcolor:$highlight

View file

@ -6,5 +6,5 @@
# (with other things) by default and is used in some other places.
for i in /tmp/mpvSockets/*/*; do
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
done

View file

@ -6,9 +6,9 @@
queuefile="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue"
while read -r line; do
[ -z "$line" ] && continue
url="${line%%[ ]*}"
qndl "$url" "curl -LO"
[ -z "$line" ] && continue
url="${line%%[ ]*}"
qndl "$url" "curl -LO"
done <"$queuefile"
echo >"$queuefile"

View file

@ -6,21 +6,21 @@ statefile="/tmp/current-keymap"
[ -r $statefile ] && current=$(cat $statefile) || current=""
setmap() {
if [ ! -r "$1" ]; then
if [ ! -r "$1" ]; then
notify-send -h string:x-dunst-stack-tag:"remaps" "󰌌 Failed to set keymap" "Could not find $1"
return 1
fi
return 1
fi
xkbcomp "$1" "$DISPLAY"
if $notify; then
notify-send -h string:x-dunst-stack-tag:"remaps" \
"󰌌 Keymap set" "Layout: $(xkbcomp :0 - | grep -oP "(?<=pc[_+])([^_+]+)(?=[_+])" | tr "(" " " | head -c -2)"
"󰌌 Keymap set" "Layout: $(xkbcomp :0 - | grep -oP "(?<=pc[_+])([^_+]+)(?=[_+])" | tr "(" " " | head -c -2)"
fi
echo "$1" >"$statefile"
xset r rate 300 50
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
killall xcape 2>/dev/null
xcape -e 'Super_L=Escape'
xset r rate 300 50
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
killall xcape 2>/dev/null
xcape -e 'Super_L=Escape'
}
rotatemap() {
@ -48,10 +48,10 @@ notify=true
while getopts dqQ flag; do
case "$flag" in
q) notify=false ;;
Q)
notify=false
error_notify=false
;;
Q)
notify=false
error_notify=false
;;
d)
setmap "$default"
return

View file

@ -4,14 +4,14 @@
#
PIDlist=$(pstree -lpATna "$(xdotool getactivewindow getwindowpid)" | sed -En 's/.*,([0-9]+).*/\1/p' | tac)
for PID in $PIDlist; do
[ -d "/proc/$PID" ] || continue
[ -d "/proc/$PID" ] || continue
cmdline=$(ps -o args= -p "$PID")
process_group_leader=$(ps -o comm= -p "$(ps -o pgid= -p "$PID" | tr -d ' ')")
cwd=$(readlink "/proc/$PID/cwd")
# zsh and lf won't be ignored even if it shows ~ or /
case "$cmdline" in
'lf -server') continue ;;
"${SHELL##*/}"|'lf'|'lf '*) break ;;
'lf -server') continue ;;
"${SHELL##*/}" | 'lf' | 'lf '*) break ;;
esac
# git (and its sub-processes) will show the root of a repository instead of the actual cwd, so they're ignored
[ "$process_group_leader" = 'git' ] || [ ! -d "$cwd" ] && continue

View file

@ -12,7 +12,7 @@ temp=$(sensors | awk '/CPU/ {printf ("%.f°C", $2)}' | tr -d "+")
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")
printf "%b" "$big﬙$normal $temp "
printf "%b" "$big﬙$normal $temp "
echo "$stats" | while read -r row; do
id=${row%% *}
rest=${row#* }

View file

@ -8,11 +8,11 @@ IFS='
types=${1:-ext2,ext3,ext4,xfs,btrfs,vfat}
first=true
for mnt in $(findmnt -Py -t "$types"); do
[ "$first" = "false" ] && printf " | "
eval $mnt
[ -d "$TARGET" ] || break
name=$TARGET
printf "%b" "${name}: $(df -H "$TARGET" | awk ' /[0-9]/ {print $3 "/" $2}')"
first=false
[ "$first" = "false" ] && printf " | "
eval $mnt
[ -d "$TARGET" ] || break
name=$TARGET
printf "%b" "${name}: $(df -H "$TARGET" | awk ' /[0-9]/ {print $3 "/" $2}')"
first=false
done
printf "\n"

View file

@ -15,7 +15,7 @@ fi
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
for e in /sys/class/net/e*/operstate; do
[ "$(cat "$e")" = "up" ] && printf "%b" "$shift"
[ "$(cat "$e")" = "up" ] && printf "%b" "$shift"
shift=" "
done
fi

View file

@ -1,3 +1,3 @@
#!/bin/sh
printf "%b" "\033[11m\033[10m "
printf "%b" "\033[11m\033[10m "
free --mega | sed -n '2{p;q}' | awk '{printf ("%2.2fG/%2.2fG\n", ($3 / 1000), ($2 / 1000))}'

View file

@ -5,17 +5,17 @@ reset="\033[0m"
icon=""
if command -v pacman 1>/dev/null 2>&1; then
num="$(pacman -Qu | grep -Fcv "[ignored]")"
[ "$num" -gt 0 ] && printf "%b" "$big$icon$reset$num"
num="$(pacman -Qu | grep -Fcv "[ignored]")"
[ "$num" -gt 0 ] && printf "%b" "$big$icon$reset$num"
fi
if command -v apt 1>/dev/null 2>&1; then
vals=$(apt upgrade -sy 2>/dev/null | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9 ' | tr ' ' '\n' | grep '[0-9]\+' | xargs)
vals=$(apt upgrade -sy 2>/dev/null | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9 ' | tr ' ' '\n' | grep '[0-9]\+' | xargs)
for i in $vals; do
[ "$i" != 0 ] && updates_available=yes
out="$out$i/"
done
for i in $vals; do
[ "$i" != 0 ] && updates_available=yes
out="$out$i/"
done
[ -n "$updates_available" ] && printf "%b" "$big$icon$reset $(echo "$out" | sed 's/\/$//')" || exit 0
[ -n "$updates_available" ] && printf "%b" "$big$icon$reset $(echo "$out" | sed 's/\/$//')" || exit 0
fi

View file

@ -1,6 +1,6 @@
#!/bin/sh
transmission-remote $@ -l -N "$XDG_CONFIG_HOME/netrc" | grep % |
# The letters are for sorting and will not appear. \
# The letters are for sorting and will not appear. \
sed "
s/.*Stopped.*/A /;
s/.*Seeding.*/Z 﫠/;

View file

@ -1,11 +1,11 @@
#!/bin/sh
if pidof picom; then
killall picom
notify-send -h string:x-dunst-stack-tag:"togcom" \
"Compositor Off"
killall picom
notify-send -h string:x-dunst-stack-tag:"togcom" \
"Compositor Off"
else
setsid -f picom
notify-send -h string:x-dunst-stack-tag:"togcom" \
"Compositor On"
setsid -f picom
notify-send -h string:x-dunst-stack-tag:"togcom" \
"Compositor On"
fi

View file

@ -1,8 +1,8 @@
#!/bin/sh
TPdevice=$( xinput | sed -nre '/TouchPad|Touchpad/s/.*id=([0-9]*).*/\1/p' )
TPdevice=$(xinput | sed -nre '/TouchPad|Touchpad/s/.*id=([0-9]*).*/\1/p')
if xinput list-props "$TPdevice" | grep -oPq "Device Enabled \(\d*\):\s*1"; then
xinput --disable "$TPdevice" && notify-send -h string:x-dunst-stack-tag:"togtp" "Touchpad Disabled" -i input-touchpad-off
xinput --disable "$TPdevice" && notify-send -h string:x-dunst-stack-tag:"togtp" "Touchpad Disabled" -i input-touchpad-off
else
xinput --enable "$TPdevice" && notify-send -h string:x-dunst-stack-tag:"togtp" "Touchpad Enabled" -i input-touchpad-on
xinput --enable "$TPdevice" && notify-send -h string:x-dunst-stack-tag:"togtp" "Touchpad Enabled" -i input-touchpad-on
fi

View file

@ -10,15 +10,12 @@ NC='\033[0m'
command -v apt 1>/dev/null 2>&1 && sudo apt upgrade
# void ----------------------------------------------------------------------------
# Void doesn't have post-install hooks at all, and including pkills in the package hooks isn't feasible
# Instead pkill is called in this script. Manually running updates will cause the status bar to desync
command -v xbps-install 1>/dev/null 2>&1 && sudo xbps-install -Syu && pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
# newversion=$(grep -oP '(?<=\* version: )\d\d\d' "$(DISPLAY=invalid "$DOTS_DIR"/.local/share/firefox/updater.sh -r 2>/dev/null | grep -oP '(?<=Warning: user.js was saved to temporary file )/tmp/tmp\.\w+\.js')")
# oldversion=$(grep -oP '(?<=\* version: )\d\d\d' "$DOTS_DIR"/.local/share/firefox/user.js)
#