aboutsummaryrefslogtreecommitdiff
path: root/env/.local/bin
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2026-06-10 00:48:19 -0500
committericeyrazor <iceyrazor@mailfence.com>2026-06-10 00:48:19 -0500
commit2097b0ebfdd07ae7a8295c26703d8d88ee7a5f8f (patch)
tree97edcae29f2817f045e0fda462609679935a6fb1 /env/.local/bin
parent09156e6cea71093079af580acdd6d4a8594e14b9 (diff)
Squashed commit of the following:
made all scripts mostly posix moved from gajim to dino
Diffstat (limited to 'env/.local/bin')
-rwxr-xr-xenv/.local/bin/scripts/autoport_mc.sh8
-rwxr-xr-xenv/.local/bin/scripts/backup/backup-flash5
-rwxr-xr-xenv/.local/bin/scripts/backup/backup-flash-priv5
-rwxr-xr-xenv/.local/bin/scripts/backup/backup-to-serv2
-rwxr-xr-xenv/.local/bin/scripts/backup/backup-tol5
-rwxr-xr-xenv/.local/bin/scripts/backup/backup-tol25
-rwxr-xr-xenv/.local/bin/scripts/backup/bbackup5
-rwxr-xr-xenv/.local/bin/scripts/backup/bbackup-browser5
-rwxr-xr-xenv/.local/bin/scripts/backup/copy-media5
-rwxr-xr-xenv/.local/bin/scripts/backup/pull-froml5
-rwxr-xr-xenv/.local/bin/scripts/bri1
-rwxr-xr-xenv/.local/bin/scripts/dmount17
-rwxr-xr-xenv/.local/bin/scripts/fzf-thumb4
-rwxr-xr-xenv/.local/bin/scripts/gen-thumb-md17
-rwxr-xr-xenv/.local/bin/scripts/math2
-rwxr-xr-xenv/.local/bin/scripts/preview-image-typed.sh3
-rwxr-xr-xenv/.local/bin/scripts/set-pri-java.sh1
-rwxr-xr-xenv/.local/bin/system/kaomoji-picker.sh8
-rwxr-xr-xenv/.local/bin/system/neoboot.sh4
-rwxr-xr-xenv/.local/bin/system/start-scripts/autostart.sh10
-rwxr-xr-xenv/.local/bin/system/start-scripts/newsboat-fetch.sh4
-rwxr-xr-xenv/.local/bin/system/stbar/killbar.sh1
-rwxr-xr-xenv/.local/bin/system/url-handler.sh10
23 files changed, 75 insertions, 57 deletions
diff --git a/env/.local/bin/scripts/autoport_mc.sh b/env/.local/bin/scripts/autoport_mc.sh
index 5cad216..370ff14 100755
--- a/env/.local/bin/scripts/autoport_mc.sh
+++ b/env/.local/bin/scripts/autoport_mc.sh
@@ -2,12 +2,12 @@
# this finds the log file from a picked instance using rofi. then fords traffic thorugh 25565
if [ -z "$LOG_FILE" ]; then
- choice="$HOME/stuff/minecraft/polymc/instances/$(ls ~/stuff/minecraft/polymc/instances | rofi -dmenu -p "Instance")"
+ choice="$HOME/stuff/minecraft/polymc/instances/$(find ~/stuff/minecraft/polymc/instances -maxdepth 1 -exec basename {} \; | rofi -dmenu -p "Instance")"
LOG_FILE="$(find "$choice" -mindepth 1 -maxdepth 1 -type d | grep "minecraft$")/logs/latest.log"
fi
-setport="$(cat "$LOG_FILE" | grep "Started on" | sed 's/.*Started on //' | tail -n 1)"
-echo $setport
+setport="$(grep "Started on" "$LOG_FILE" | sed 's/.*Started on //' | tail -n 1)"
+echo "$setport"
if [ "$setport" ]; then
- doas socat TCP6-LISTEN:25565,fork TCP4:127.0.0.1:$setport
+ doas socat -v TCP6-LISTEN:25565,fork TCP4:127.0.0.1:"$setport"
fi
diff --git a/env/.local/bin/scripts/backup/backup-flash b/env/.local/bin/scripts/backup/backup-flash
index 051b6d6..2f078fa 100755
--- a/env/.local/bin/scripts/backup/backup-flash
+++ b/env/.local/bin/scripts/backup/backup-flash
@@ -1,10 +1,11 @@
#!/bin/sh
-cd ~
+cd ~ || exit
fsync () {
rsync -RUuavn --delete-after $exclude $syncfile "$target"
printf "===commit these changes?\n"
- read -p "y/n: " uinput
+ printf "y/n: "
+ read -r uinput
if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then
printf "\n\n\n"
rsync -RUuav --progress --delete-after $exclude $syncfile "$target"
diff --git a/env/.local/bin/scripts/backup/backup-flash-priv b/env/.local/bin/scripts/backup/backup-flash-priv
index 7fceb6c..dae5936 100755
--- a/env/.local/bin/scripts/backup/backup-flash-priv
+++ b/env/.local/bin/scripts/backup/backup-flash-priv
@@ -1,11 +1,12 @@
#!/bin/sh
-cd ~/stuff/scripts
+cd ~/stuff/scripts || exit
fsync () {
# t?
rsync -RUuavn --delete-after $exclude $syncfile "$target"
printf "===commit these changes?\n"
- read - "y/n: " uinput
+ printf "y/n: "
+ read -r uinput
if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then
printf "\n\n\n"
rsync -RUuav --progress --delete-after $exclude $syncfile "$target"
diff --git a/env/.local/bin/scripts/backup/backup-to-serv b/env/.local/bin/scripts/backup/backup-to-serv
index b0525b3..cf2f76f 100755
--- a/env/.local/bin/scripts/backup/backup-to-serv
+++ b/env/.local/bin/scripts/backup/backup-to-serv
@@ -1,3 +1,3 @@
#!/bin/sh
-cd /home/iceyrazor/stuff/scripts/LINUX-SERVER1/home/iceyfoxservers/
+cd /home/iceyrazor/stuff/scripts/LINUX-SERVER1/home/iceyfoxservers/ || exit
rsync -RUurv servers/ servg:~
diff --git a/env/.local/bin/scripts/backup/backup-tol b/env/.local/bin/scripts/backup/backup-tol
index 2d11371..d806296 100755
--- a/env/.local/bin/scripts/backup/backup-tol
+++ b/env/.local/bin/scripts/backup/backup-tol
@@ -1,5 +1,5 @@
#!/bin/sh
-cd ~/
+cd ~/ || exit
fsynca () {
# t?
@@ -8,7 +8,8 @@ fsynca () {
fsyncb () {
printf "===confirm changes?\n"
- read -p "y/n: " uinput
+ printf "y/n: "
+ read -r uinput
if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then
printf "\n\n\n"
rsync -RUuav --progress --delete-after $exclude $syncfile "$target"
diff --git a/env/.local/bin/scripts/backup/backup-tol2 b/env/.local/bin/scripts/backup/backup-tol2
index 839f0af..3cf2adf 100755
--- a/env/.local/bin/scripts/backup/backup-tol2
+++ b/env/.local/bin/scripts/backup/backup-tol2
@@ -1,5 +1,5 @@
#!/bin/sh
-cd ~/
+cd ~/ || exit
fsynca () {
# t?
@@ -8,7 +8,8 @@ fsynca () {
fsyncb () {
printf "===confirm changes?\n"
- read -p "y/n: " uinput
+ printf "y/n: "
+ read -r uinput
if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then
printf "\n\n\n"
rsync -RUuav --progress --delete-after $exclude $syncfile "$target"
diff --git a/env/.local/bin/scripts/backup/bbackup b/env/.local/bin/scripts/backup/bbackup
index 7a4cb70..9d0b64a 100755
--- a/env/.local/bin/scripts/backup/bbackup
+++ b/env/.local/bin/scripts/backup/bbackup
@@ -1,5 +1,5 @@
#!/bin/sh
-cd ~/
+cd ~/ || exit
fsynca () {
# t?
@@ -8,7 +8,8 @@ fsynca () {
fsyncb () {
printf "===confirm changes?\n"
- read -p "y/n: " uinput
+ printf "y/n: "
+ read -r uinput
if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then
printf "\n\n\n"
rsync -RUuav --progress --delete-after $exclude $syncfile "$target"
diff --git a/env/.local/bin/scripts/backup/bbackup-browser b/env/.local/bin/scripts/backup/bbackup-browser
index 465ffaf..f969dd1 100755
--- a/env/.local/bin/scripts/backup/bbackup-browser
+++ b/env/.local/bin/scripts/backup/bbackup-browser
@@ -1,5 +1,5 @@
#!/bin/sh
-cd ~/
+cd ~/ || exit
fsynca () {
# t?
@@ -8,7 +8,8 @@ fsynca () {
fsyncb () {
printf "===confirm changes?\n"
- read -p "y/n: " uinput
+ printf "y/n: "
+ read -r uinput
if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then
printf "\n\n\n"
rsync -RUuav --progress --delete-after $exclude $syncfile "$target"
diff --git a/env/.local/bin/scripts/backup/copy-media b/env/.local/bin/scripts/backup/copy-media
index 5fa762b..0c6832c 100755
--- a/env/.local/bin/scripts/backup/copy-media
+++ b/env/.local/bin/scripts/backup/copy-media
@@ -1,5 +1,5 @@
#!/bin/sh
-cd ~/stuff/media/music/
+cd ~/stuff/media/music/ || exit
fsynca () {
# t?
@@ -8,7 +8,8 @@ fsynca () {
fsyncb () {
printf "===confirm changes?\n"
- read -p "y/n: " uinput
+ printf "y/n: "
+ read -r uinput
if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then
printf "\n\n\n"
rsync -RUuav --progress --delete-after $exclude $syncfile "$target"
diff --git a/env/.local/bin/scripts/backup/pull-froml b/env/.local/bin/scripts/backup/pull-froml
index 63d1f05..4ad323a 100755
--- a/env/.local/bin/scripts/backup/pull-froml
+++ b/env/.local/bin/scripts/backup/pull-froml
@@ -1,5 +1,5 @@
#!/bin/sh
-cd ~/
+cd ~/ || exit
fsynca () {
# t?
@@ -8,7 +8,8 @@ fsynca () {
fsyncb () {
printf "===confirm changes?\n"
- read -p "y/n: " uinput
+ printf "y/n: "
+ read -r uinput
if [ "$uinput" != "n" ] && [ "$uinput" != "N" ]; then
printf "\n\n\n"
rsync -RUuav --progress $exclude $syncfile "$target"
diff --git a/env/.local/bin/scripts/bri b/env/.local/bin/scripts/bri
index b943f30..36e7bd0 100755
--- a/env/.local/bin/scripts/bri
+++ b/env/.local/bin/scripts/bri
@@ -1 +1,2 @@
+#!/bin/sh
echo "$1" > /sys/class/backlight/intel_backlight/brightness
diff --git a/env/.local/bin/scripts/dmount b/env/.local/bin/scripts/dmount
index b157208..863c35f 100755
--- a/env/.local/bin/scripts/dmount
+++ b/env/.local/bin/scripts/dmount
@@ -1,6 +1,6 @@
#!/bin/sh
sudo="sudo"
-[ doas ] && sudo="doas"
+which doas && sudo="doas"
umo=0
@@ -8,13 +8,16 @@ while getopts "u" opt; do
case "$opt" in
u) umo=1
;;
+ *) echo invalid arg
+ exit
+ ;;
esac
done
shift $((OPTIND-1))
[ "${1:-}" = "--" ] && shift
-if [ $umo == 1 ]; then
+if [ $umo = 1 ]; then
nf=4
else
nf=3
@@ -24,12 +27,12 @@ fi
parts="$(lsblk -rno path,size,type,mountpoint | grep -e part -e lvm | awk "NF==$nf {print \$1, \$2, \$3, \$4}")"
# choice="$(printf "$parts" | rofi -dmenu "beans" | sed 's/ .*//')"
-choice="$(printf "$parts" | fzf | sed 's/ .*//')"
+choice="$(printf -- "%s" "$parts" | fzf | sed 's/ .*//')"
-[ "$choice" == "" ] && exit 0
+[ "$choice" = "" ] && exit 0
-if [ $umo == 1 ]; then
- $sudo umount $choice
+if [ $umo = 1 ]; then
+ $sudo umount "$choice"
else
- $sudo mount $choice /mnts/flash
+ $sudo mount "$choice" /mnts/flash
fi
diff --git a/env/.local/bin/scripts/fzf-thumb b/env/.local/bin/scripts/fzf-thumb
index 7882726..c9d6d94 100755
--- a/env/.local/bin/scripts/fzf-thumb
+++ b/env/.local/bin/scripts/fzf-thumb
@@ -2,7 +2,7 @@
FZF_PREVIEW_LINES=50
FZF_PREVIEW_COLUMN=50
-script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+script_dir="$( cd "$( dirname "$0" )" || exit > /dev/null && pwd )"
Preview_file="$script_dir/preview-image-typed.sh"
@@ -13,7 +13,7 @@ if [ ! "$view_dir" ]; then
exit 1
fi
-cd "$view_dir"
+cd "$view_dir" || exit
while :; do
open_file=$(fzf --preview "$Preview_file {} $FZF_PREVIEW_LINES $FZF_PREVIEW_COLUMN")
diff --git a/env/.local/bin/scripts/gen-thumb-md b/env/.local/bin/scripts/gen-thumb-md
index d28378a..4308bf6 100755
--- a/env/.local/bin/scripts/gen-thumb-md
+++ b/env/.local/bin/scripts/gen-thumb-md
@@ -1,5 +1,5 @@
#!/bin/sh
-script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+script_dir="$( cd "$( dirname "$0" )" || exit > /dev/null && pwd )"
disable_thumb_gen=0
disable_auto_editor=0
@@ -9,6 +9,9 @@ while getopts "de" opt; do
;;
e) disable_auto_editor=1
;;
+ *) echo invalid arg
+ exit
+ ;;
esac
done
@@ -23,12 +26,12 @@ if [ ! "$view_dir" ]; then
exit 1
fi
-view_dir="$( cd "$view_dir" &> /dev/null && pwd )"
+view_dir="$( cd "$view_dir" || exit > /dev/null && pwd )"
to_file() {
printf -- "- [%s](<%s>)" "$2" "$1" >> genthumb.md
- if [ $3 == 1 ]; then
+ if [ "$3" = 1 ]; then
printf -- "\n - ![%s](</tmp/gen-thumb-md/%s.png>)\n" "$2" "$2" >> genthumb.md
else
printf -- "\n - ![%s](<%s>)\n" "$2" "$1" >> genthumb.md
@@ -40,7 +43,7 @@ gen_thumb() {
file_name="$(basename "$file")"
case "$file" in
*.avi|*.gif|*.mp4|*.mkv|*.webm|*.mov)
- if [ $disable_thumb_gen == 0 ]; then
+ if [ $disable_thumb_gen = 0 ]; then
ffmpegthumbnailer -i "$file" -s 0 -q 5 -o "/tmp/gen-thumb-md/$file_name.png"
fi
to_file "$file" "$file_name" 1
@@ -57,15 +60,15 @@ if [ ! -d /tmp/gen-thumb-md ]; then
fi
-printf "# gen thumb $view_dir\n\n" > genthumb.md
+printf -- "# gen thumb %s\n\n" "$view_dir" > genthumb.md
files="$(find "$view_dir" -type f)"
-printf "$files" | while read file; do
+printf -- "%s" "$files" | while read -r file; do
gen_thumb "$file"
done
-if [ $disable_auto_editor == 0 ]; then
+if [ $disable_auto_editor = 0 ]; then
$EDITOR ./genthumb.md
fi
diff --git a/env/.local/bin/scripts/math b/env/.local/bin/scripts/math
index 9c9b305..2236da4 100755
--- a/env/.local/bin/scripts/math
+++ b/env/.local/bin/scripts/math
@@ -2,7 +2,7 @@
expression=$1
precision=$2
-if [ "$precision" == "" ]; then
+if [ "$precision" = "" ]; then
precision=1;
fi;
diff --git a/env/.local/bin/scripts/preview-image-typed.sh b/env/.local/bin/scripts/preview-image-typed.sh
index 013ac2a..542799b 100755
--- a/env/.local/bin/scripts/preview-image-typed.sh
+++ b/env/.local/bin/scripts/preview-image-typed.sh
@@ -1,6 +1,7 @@
+#!/bin/sh
preview() {
# chafa "$@" -f sixel -s "$(($2-2))x$3" | sed 's/#/\n#/g'
- chafa "$1" --clear -f iterm -s $2x$3
+ chafa "$1" --clear -f iterm -s "$2"x"$3"
}
thumbnail="/tmp/thumbnail.png"
diff --git a/env/.local/bin/scripts/set-pri-java.sh b/env/.local/bin/scripts/set-pri-java.sh
index 6371ee0..e9577bb 100755
--- a/env/.local/bin/scripts/set-pri-java.sh
+++ b/env/.local/bin/scripts/set-pri-java.sh
@@ -1 +1,2 @@
+#!/bin/sh
doas renice -20 -p $(doas pidof java)
diff --git a/env/.local/bin/system/kaomoji-picker.sh b/env/.local/bin/system/kaomoji-picker.sh
index a59e3c7..ac8e6b8 100755
--- a/env/.local/bin/system/kaomoji-picker.sh
+++ b/env/.local/bin/system/kaomoji-picker.sh
@@ -6,14 +6,14 @@ KAO_FILE="$HOME/stuff/manual-programs/KaomojiList/kaomojis.json"
choices=$(jq '.[]|.categories|.[]|.name' "$KAO_FILE" | sed 's/"//g')
-choice=$(echo "$choices" | sed /^$/d | rofi -dmenu "$prompt_message")
+choice=$(echo "$choices" | sed /^$/d | rofi -dmenu)
emojlist=$(jq -r --arg sel "$choice" '..| select(.name==$sel)? | .emoticons | .[]' "$KAO_FILE")
-emoj=$(echo "$emojlist" | sed /^$/d | rofi -dmenu "$prompt_message")
+emoj=$(echo "$emojlist" | sed /^$/d | rofi -dmenu)
if [ "$WAYLAND_DISPLAY" ]; then
- printf -- "$emoj" | wl-copy
+ printf -- "%s" "$emoj" | wl-copy
else
- printf -- "$emoj" | xclip -sel clip
+ printf -- "%s" "$emoj" | xclip -sel clip
fi
diff --git a/env/.local/bin/system/neoboot.sh b/env/.local/bin/system/neoboot.sh
index 014f4b1..e93af89 100755
--- a/env/.local/bin/system/neoboot.sh
+++ b/env/.local/bin/system/neoboot.sh
@@ -1,12 +1,12 @@
#!/bin/sh
normal() {
- fastfetch -c $HOME/.config/fastfetch/ascii.jsonc
+ fastfetch -c "$HOME/.config/fastfetch/ascii.jsonc"
printf "\n"
}
if [ -z $(pgrep VRChat) ]; then
- if [[ "$(cat /etc/hostname)" == "Witchen" ]]; then
+ if [ "$(cat /etc/hostname)" = "Witchen" ]; then
normal
else
normal
diff --git a/env/.local/bin/system/start-scripts/autostart.sh b/env/.local/bin/system/start-scripts/autostart.sh
index db9d31f..b17876a 100755
--- a/env/.local/bin/system/start-scripts/autostart.sh
+++ b/env/.local/bin/system/start-scripts/autostart.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-cd "$(dirname "$0")"
+cd "$(dirname "$0")" || exit
sleep 0.1
xset s 0
@@ -9,7 +9,7 @@ if [ "$WAYLAND_DISPLAY" ]; then
PID=$(pidof swaybg)
swaybg -o HDMI-A-1 -i "/home/iceyrazor/stuff/media/wallpapers/neotheta2.png" -m fill -o DP-1 -i "/home/iceyrazor/stuff/media/wallpapers/neotheta2.png" -m fill & disown
sleep 0.4s
- kill $PID
+ kill "$PID"
fi
xrdb -merge /home/iceyrazor/.Xresources &
@@ -47,7 +47,7 @@ if [ -z "$(pgrep wezterm)" ]; then
wezterm -e ~/.local/bin/system/task.sh &
fi
-if [ "$(cat /etc/hostname)" == "Kasino" ]; then
+if [ "$(cat /etc/hostname)" = "Kasino" ]; then
if [ -z "$(pgrep vesktop)" ]; then
vesktop %U & disown
fi
@@ -64,8 +64,8 @@ if [ "$(cat /etc/hostname)" == "Kasino" ]; then
QT_QPA_PLATFORMTHEME="" mumble & disown
fi
- if [ -z "$(pgrep gajim)" ]; then
- gajim & disown
+ if [ -z "$(pgrep dino)" ]; then
+ dino & disown
fi
if [ -z "$(pgrep mpd)" ]; then
diff --git a/env/.local/bin/system/start-scripts/newsboat-fetch.sh b/env/.local/bin/system/start-scripts/newsboat-fetch.sh
index 06b08d9..5eefe9b 100755
--- a/env/.local/bin/system/start-scripts/newsboat-fetch.sh
+++ b/env/.local/bin/system/start-scripts/newsboat-fetch.sh
@@ -4,9 +4,9 @@ newsboat_loop(){
#newsboat -x print-unread | xargs -0 notify-send "newsboat feed"
unreads=$(newsboat -x print-unread)
- unreadnum=$(printf "$unreads" | sed 's/ .*//g')
+ unreadnum=$(printf -- "%s" "$unreads" | sed 's/ .*//g')
- if (( $unreadnum > 0 )); then
+ if [ "$unreadnum" -gt 0 ]; then
notify-send "newsboat feed" "$unreads"
fi
notify-send "Vitamins!" "take them"
diff --git a/env/.local/bin/system/stbar/killbar.sh b/env/.local/bin/system/stbar/killbar.sh
index 1450a84..b639ed1 100755
--- a/env/.local/bin/system/stbar/killbar.sh
+++ b/env/.local/bin/system/stbar/killbar.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
pids=$(ps -AO pid | awk '/stbar.sh|newsboat-fetch.sh/ {print $1}')
# pids=$(pstree -pla | grep stbar | sed 's,|,,g' | sed 's/ //g' | sed 's/^ //g' | sed 's/ .*//' | sed 's/[^0-9]*//g')
# pids2=$(ps -AO pid | grep "sh ./newsboat-fetch.sh" | sed 's/S.*//g' | sed 's/^ *//g')
diff --git a/env/.local/bin/system/url-handler.sh b/env/.local/bin/system/url-handler.sh
index d7be722..5d0e893 100755
--- a/env/.local/bin/system/url-handler.sh
+++ b/env/.local/bin/system/url-handler.sh
@@ -2,7 +2,7 @@
url=$@
prompt_message="Open with:"
-echo $url
+echo "$url"
choices="
clipboard
@@ -12,11 +12,11 @@ browser/xdg-open
choice=$(echo "$choices" | sed /^$/d | rofi -dmenu "$prompt_message")
choice=$(echo "$choice" | sed -e 's/browser\/xdg-open/xdg-open/')
-if [ "$choice" == "clipboard" ]; then
- if [ -z $WAYLAND_DISPLAY ]; then
- printf "$url" | xclip -selection clipboard
+if [ "$choice" = "clipboard" ]; then
+ if [ -z "$WAYLAND_DISPLAY" ]; then
+ printf -- "%s" "$url" | xclip -selection clipboard
else
- printf "$url" | wl-copy
+ printf -- "%s" "$url" | wl-copy
fi
else
$choice "$url" & disown