This commit is contained in:
ange 2025-05-29 07:52:56 +00:00
parent 337c12125d
commit 81da0e63fa
Signed by: ange
GPG key ID: 9E0C4157BB7BEB1D
38 changed files with 93 additions and 90 deletions

View file

@ -15,9 +15,6 @@ if [ -z "$q" ]; then
elif [[ "$q" == *://* ]]; then
url="${q/*+( )/}"
if [ "$1" = -p ] || [[ "$url" == http?(s)://* ]]; then
exec $BROWSER "$url"
fi
exec xdg-open "$url"
fi
if [[ "$q" =~ ^[^[:space:]]+(\.[^[:space:]]+)+$ ]]; then

View file

@ -1,6 +1,7 @@
#!/bin/bash
sites=(
'https://chat.mistral.ai'
'https://discord.com'
'https://gmoker.com'
'https://login.microsoftonline.com'
@ -20,7 +21,7 @@ function update() {
done < <(awk -F= '/^Path=/{print $2}' "$ff/profiles.ini")
}
ff="$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox"
ff="$HOME/.mozilla/firefox"
if [ "$1" == update ]; then
update
@ -35,4 +36,4 @@ if ! fuser -s "$profile"; then
sqlite3 "$profile/permissions.sqlite" <<< "DELETE FROM moz_perms; $sq"
sqlite3 "$profile/places.sqlite" <<< "DELETE FROM moz_bookmarks;"
fi
org.mozilla.firefox "$@"
/usr/bin/firefox "$@"

View file

@ -1,9 +1,9 @@
#!/bin/bash
function scrypto() {
local c
local tmp
c="$(crypto 2> /dev/null)" && echo "$c" > crypto
tmp="$(crypto 2> /dev/null)" && echo "$tmp" > crypto
}
function scpu() {
@ -25,7 +25,7 @@ function sbat() {
}
function svol() {
local st v vol=('' ' ') mut=('🔇' ' ') m
local st v m vol=('' ' ') mut=('🔇' ' ')
mapfile -t st <<< "$(wpctl status | sed -n 's/.*\*.*\[vol: \(.*\)]/\1/p')"
if [ -z "${st[0]}" ]; then
@ -74,9 +74,19 @@ function svpn() {
fi > vpn
}
function stz() {
local tmp ip; ip="$(ip route | grep -oP '^default.*src\s+\K[^\s]+')"
if [ "$ip" != "$(cat ip)" ]; then
tmp="$(curl -s --interface wlan0 'https://ipapi.co/timezone')" \
&& echo "$tmp" > tz
echo "$ip" > ip
fi
}
function stime() {
# shellcheck disable=SC2238
TZ=Asia/Makassar date '+%a %m-%d %R %Z' > time
TZ="$(cat tz)" date '+%a %m-%d %R%:::z' > time
}
function display() {
@ -87,31 +97,31 @@ function display() {
xsetroot -name "$crypto | $cpu | $memory | $vol | $net$vpn | $bat | $time"
}
# SIGNALING
# trap '<function>;display;wait' 'RTMIN+n'
trap 'svol;display;wait' 'RTMIN+0'
trap 'snet;display;wait' 'RTMIN+1'
trap 'svpn;display;wait' 'RTMIN+2'
# to update it from external commands
## kill -m "$(cat "$XDG_CACHE_HOME/pidofbar")"
# where m = 34 + n
# TODO
#trap 'kill -INT 0; wait' INT
mkdir -p "$XDG_RUNTIME_DIR/sbar" && cd "$XDG_RUNTIME_DIR/sbar" || exit 1
echo "$$" > pid
mkdir -p "$XDG_RUNTIME_DIR/sbar"
cd "$XDG_RUNTIME_DIR/sbar" || exit 1
(while :; do
scrypto
sleep $((300 - 10#$(date '+%S') % 300)) & wait
stz
sleep 300
done &)
while true; do
(while :; do
scpu
smemory
sbat
svol
snet
svpn
sbat
stime
display
sleep $((5 - 10#$(date '+%S') % 5)) & wait
done
sleep $((5 - 10#$(date '+%S') % 5))
done &)
while read -r _ _ f; do
"s$f"
display
done < <(inotifywait -qme attrib .)

View file

@ -33,4 +33,4 @@ else
fi
fi
kill -34 "$(cat "$XDG_RUNTIME_DIR/sbar/pid")"
touch "$XDG_RUNTIME_DIR/sbar/vol"

View file

@ -23,4 +23,4 @@ while read -r i; do
wg-quick down "$i"
done < <(ip -br link show type wireguard | awk "\$1 != \"$1\"{print \$1}")
kill -36 "$(cat "$XDG_RUNTIME_DIR/sbar/pid")"
touch "$XDG_RUNTIME_DIR/sbar/vpn"

View file

@ -9,7 +9,7 @@ fi
for _ in {0..29}; do
if "${iwctl[@]}" show | grep -q '\s*State\s\+connected\s*$'; then
kill -35 "$(cat "$XDG_RUNTIME_DIR/sbar/pid")"
touch "$XDG_RUNTIME_DIR/sbar/net"
exit 0
fi
sleep 1

View file

@ -29,4 +29,4 @@ devs="$(getdevs "$CLASS" | grep -v "$dev")"$'\n'"* $dev"
read -r id <<< "$(dmenu -l 16 <<< "$devs" | sed 's/*//')"
wpctl set-default "$id"
kill -34 "$(cat "$XDG_RUNTIME_DIR/sbar/pid")"
touch "$XDG_RUNTIME_DIR/sbar/vol"