mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-01-30 09:48:11 +01:00
Compare commits
9 Commits
e006007b7d
...
60a18f6372
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60a18f6372 | ||
|
|
f26e5678e6 | ||
|
|
ed9633da3f | ||
|
|
ec8e82745e | ||
|
|
44cb5f12e6 | ||
|
|
d08eea1cf5 | ||
|
|
fe6b9043b8 | ||
|
|
62618ae588 | ||
|
|
f313b6c0f5 |
@ -16,5 +16,8 @@ IFS='
|
||||
|
||||
# Update each found profile.
|
||||
for profile in $profiles; do
|
||||
arkenfox-updater -p "${profile%%/user.js*}" -s
|
||||
userjs=${profile%%/user.js*}
|
||||
user=$(stat -c '%U' "$userjs") || continue
|
||||
|
||||
su -l "$user" -c "arkenfox-updater -c -p $userjs -s"
|
||||
done
|
||||
|
||||
35
.local/bin/fixnames
Normal file
35
.local/bin/fixnames
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$(id -u)" = "0" ] && echo "This script should not be run as root" >&2 && exit 1
|
||||
|
||||
find . -type d -path '*/.*' -prune -o -print0 | xargs -0 -n1 -P10 -I{} sh -c '
|
||||
generate_unique_name() {
|
||||
base_name="$1"; ext="$2"; dest_path="$3"; count=1
|
||||
[ -z "$ext" ] && new_name="$base_name" || new_name="${base_name}.${ext}"
|
||||
while [ -e "${dest_path}/${new_name}" ]; do
|
||||
[ -z "$ext" ] && new_name="${base_name}_${count}" || new_name="${base_name}_${count}.${ext}"
|
||||
count=$(( count + 1 ))
|
||||
done
|
||||
echo "$new_name"
|
||||
}
|
||||
process_item() {
|
||||
item_path="$1";
|
||||
[ "$item_path" = "." ] && return
|
||||
dir_name=$(dirname "$item_path"); base_name=$(basename "$item_path")
|
||||
[ -d "$item_path" ] && {
|
||||
new_name=$(echo "$base_name" | sed -E "s/[^a-zA-Z0-9 _.-]+//g; s/[ .-]+/_/g; s/_+/_/g; s/^_//; s/_$//; s/(.*)/\L\1/")
|
||||
[ -z "$new_name" ] && new_name="untitled"
|
||||
} || {
|
||||
file_ext="${base_name##*.}"
|
||||
base_name_no_ext="${base_name%.*}"
|
||||
new_base_name_no_ext=$(echo "$base_name_no_ext" | sed -E "s/[^a-zA-Z0-9 _.-]+//g; s/[ .-]+/_/g; s/_+/_/g; s/^_//; s/_$//; s/(.*)/\L\1/")
|
||||
[ -z "$new_base_name_no_ext" ] && new_base_name_no_ext="untitled"
|
||||
[ -z "$file_ext" ] || [ "$file_ext" = "$base_name_no_ext" ] && new_name="$new_base_name_no_ext" || new_name="${new_base_name_no_ext}.${file_ext}"
|
||||
}
|
||||
[ "$base_name" != "$new_name" ] && {
|
||||
[ -e "${dir_name}/${new_name}" ] && new_name=$(generate_unique_name "${new_name%.*}" "${new_name##*.}" "$dir_name")
|
||||
mv "$item_path" "${dir_name}/${new_name}" 2>/dev/null || true
|
||||
}
|
||||
}
|
||||
process_item "{}"
|
||||
' 2>/dev/null
|
||||
@ -15,7 +15,7 @@ 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 ;;
|
||||
*png|*jpg|*jpe|*jpeg|*gif)
|
||||
*png|*jpg|*jpe|*jpeg|*gif|*webp)
|
||||
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && nsxiv -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 & ;;
|
||||
|
||||
@ -13,11 +13,18 @@ bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/bg"
|
||||
dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
|
||||
zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
|
||||
|
||||
# Give -s as parameter to make notifications silent.
|
||||
while getopts "s" o; do case "${o}" in
|
||||
s) silent='1' ;;
|
||||
esac done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
trueloc="$(readlink -f "$1")" &&
|
||||
case "$(file --mime-type -b "$trueloc")" in
|
||||
image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
||||
inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
|
||||
*) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
|
||||
image/* ) ln -sf "$trueloc" "$bgloc" && [ -z "$silent" ] && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
||||
inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && [ -z "$silent" ] && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
|
||||
*) [ -z "$silent" ] && notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
|
||||
esac
|
||||
|
||||
# If pywal is installed, use it.
|
||||
|
||||
@ -17,10 +17,17 @@ case $BLOCK_BUTTON in
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then
|
||||
# Wifi
|
||||
if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then
|
||||
wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
|
||||
elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then
|
||||
grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="📡 " || wifiicon="❌ "
|
||||
elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then
|
||||
[ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="📡 " || wifiicon="❌ "
|
||||
fi
|
||||
|
||||
printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)"
|
||||
# Ethernet
|
||||
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="🌐 " || ethericon="❎ "
|
||||
|
||||
# TUN
|
||||
[ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon="🔒 "
|
||||
|
||||
printf "%s%s%s\n" "$wifiicon" "$ethericon" "$tunicon"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user