Add ringtones/wallpapers plugins, AT console, dialer USSD/*#06#, and SIM icon fix

This commit is contained in:
Luxferre
2026-10-24 19:58:11 +03:00
parent e549aaf413
commit dc59704547
64 changed files with 2743 additions and 130 deletions
@@ -81,7 +81,23 @@ else
fi
xrdb -merge "$HOME/.Xresources" >/dev/null 2>&1 || true
feh --bg-fill /usr/share/wallpapers/bananarchy.png >/dev/null 2>&1 </dev/null &
WP_FILE="/usr/share/wallpapers/bananarchy.png"
if [ -f "$XDG_CONFIG_HOME/sxmo/wallpaper" ]; then
custom_wp="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/wallpaper" 2>/dev/null)"
[ -n "$custom_wp" ] && [ -f "$custom_wp" ] && WP_FILE="$custom_wp"
fi
WP_FLAG="--bg-fill"
if [ -f "$XDG_CONFIG_HOME/sxmo/wallpaper_mode" ]; then
wp_mode="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/wallpaper_mode" 2>/dev/null)"
case "$wp_mode" in
scale|--bg-scale) WP_FLAG="--bg-scale" ;;
max|--bg-max) WP_FLAG="--bg-max" ;;
center|--bg-center) WP_FLAG="--bg-center" ;;
tile|--bg-tile) WP_FLAG="--bg-tile" ;;
*) WP_FLAG="--bg-fill" ;;
esac
fi
feh --no-fehbg "$WP_FLAG" "$WP_FILE" >/dev/null 2>&1 </dev/null &
pidof -s conky >/dev/null 2>&1 || CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
pidof -s fcitx5 >/dev/null 2>&1 || fcitx5 -d >/tmp/fcitx5.log 2>&1 </dev/null &
sxmo_hook_start.sh >/tmp/sxmo_hook_start.log 2>&1 </dev/null &
Binary file not shown.
+18 -2
View File
@@ -22,8 +22,24 @@ defaults() {
xsetroot -solid '#1c1c1c'
xset s off s noblank s 0 0 -dpms
[ -e "$HOME"/.Xresources ] && xrdb -merge "$HOME"/.Xresources
if [ -f /usr/share/wallpapers/bananarchy.png ] && command -v feh >/dev/null 2>&1; then
feh --no-fehbg --bg-fill /usr/share/wallpapers/bananarchy.png &
if command -v feh >/dev/null 2>&1; then
WP_FILE="/usr/share/wallpapers/bananarchy.png"
if [ -f "$XDG_CONFIG_HOME/sxmo/wallpaper" ]; then
custom_wp="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/wallpaper" 2>/dev/null)"
[ -n "$custom_wp" ] && [ -f "$custom_wp" ] && WP_FILE="$custom_wp"
fi
WP_FLAG="--bg-fill"
if [ -f "$XDG_CONFIG_HOME/sxmo/wallpaper_mode" ]; then
wp_mode="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/wallpaper_mode" 2>/dev/null)"
case "$wp_mode" in
scale|--bg-scale) WP_FLAG="--bg-scale" ;;
max|--bg-max) WP_FLAG="--bg-max" ;;
center|--bg-center) WP_FLAG="--bg-center" ;;
tile|--bg-tile) WP_FLAG="--bg-tile" ;;
*) WP_FLAG="--bg-fill" ;;
esac
fi
[ -f "$WP_FILE" ] && feh --no-fehbg "$WP_FLAG" "$WP_FILE" &
fi
}
+1
View File
@@ -0,0 +1 @@
dwm-plugin
+1
View File
@@ -0,0 +1 @@
dwm-plugin
+1
View File
@@ -0,0 +1 @@
dwm-plugin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -408,8 +408,165 @@ case "$cmd" in
exit 1
;;
imei)
imei1=""
imei2=""
imei_sv=""
if detect_qmicli_modem; then
dms_ids="$($QMICLI_MODEM --dms-get-ids 2>/dev/null || true)"
imei1="$(printf "%s\n" "$dms_ids" | sed -n "s/.*IMEI: '\([0-9]\{14,16\}\)'/\1/p" | head -n1)"
imei_sv="$(printf "%s\n" "$dms_ids" | sed -n "s/.*IMEI SV: '\([^']*\)'/\1/p" | head -n1)"
fi
if [ -z "$imei1" ]; then
imei1="$(mmcli -m any -K 2>/dev/null | awk -F': ' '/modem\.3gpp\.imei/ {print $2; exit}')"
fi
# Query secondary AT channel (/dev/wwan0at1) if present
if [ -c "/dev/wwan0at1" ]; then
at_out="$(timeout 1 sh -c '
stty -F /dev/wwan0at1 raw -echo 115200 2>/dev/null || true
(cat /dev/wwan0at1 & pid=$!; printf "AT+CGSN\r\n" > /dev/wwan0at1; sleep 0.25; kill $pid 2>/dev/null) 2>/dev/null
' 2>/dev/null | tr -d "\r" | grep -oE '^[0-9]{15}$' | head -n1 || true)"
if [ -n "$at_out" ] && [ "$at_out" != "$imei1" ]; then
imei2="$at_out"
fi
fi
# Scan factory partitions for Luhn-valid 15-digit IMEIs (TAC 35...)
if [ -z "$imei2" ]; then
for part in /dev/disk/by-partlabel/traceability /dev/disk/by-partlabel/tunning /dev/disk/by-partlabel/devinfo /dev/disk/by-partlabel/oem; do
[ -e "$part" ] || continue
cand_list="$(strings -n 14 "$part" 2>/dev/null | grep -oE '35[0-9]{13}' | awk '
{
val = $0
sum = 0
for (i = 1; i <= 14; i++) {
d = substr(val, i, 1) + 0
if (i % 2 == 0) {
d *= 2
if (d > 9) d -= 9
}
sum += d
}
chk = (10 - (sum % 10)) % 10
if (chk == (substr(val, 15, 1) + 0)) print val
}
' || true)"
for c in $cand_list; do
if [ -z "$imei1" ]; then
imei1="$c"
elif [ "$c" != "$imei1" ] && [ -z "$imei2" ]; then
imei2="$c"
break 2
fi
done
done
fi
echo "IMEI1=${imei1}"
echo "IMEI2=${imei2}"
echo "IMEI_SV=${imei_sv}"
;;
usb-tether)
mode="${2:-status}"
case "$mode" in
on)
sysctl -w net.ipv4.ip_forward=1 >/dev/null 2>&1 || true
nft add table ip nat 2>/dev/null || true
nft 'add chain ip nat postrouting { type nat hook postrouting priority 100 ; }' 2>/dev/null || true
nft add rule ip nat postrouting oifname "wwan*" masquerade 2>/dev/null || true
nft add rule ip nat postrouting oifname "wlan*" masquerade 2>/dev/null || true
ip addr show dev usb0 2>/dev/null | grep -q "172.16.42.1" || ip addr add 172.16.42.1/16 dev usb0 2>/dev/null || true
ip link set usb0 up 2>/dev/null || true
echo "1" > /tmp/bananarchy_usb_tether.active
;;
off)
sysctl -w net.ipv4.ip_forward=0 >/dev/null 2>&1 || true
nft delete table ip nat 2>/dev/null || true
nmcli connection delete USBNetworkShare >/dev/null 2>&1 || true
ip addr show dev usb0 2>/dev/null | grep -q "172.16.42.1" || ip addr add 172.16.42.1/16 dev usb0 2>/dev/null || true
ip link set usb0 up 2>/dev/null || true
rm -f /tmp/bananarchy_usb_tether.active
;;
*)
if [ -f /tmp/bananarchy_usb_tether.active ] && [ "$(sysctl -n net.ipv4.ip_forward 2>/dev/null || echo 0)" = "1" ]; then
echo "ACTIVE=1"
else
echo "ACTIVE=0"
fi
;;
esac
;;
at)
port="${2:-auto}"
shift 2 2>/dev/null || true
at_cmd="$*"
if [ -z "$at_cmd" ]; then
echo "ERROR: Empty AT command"
exit 1
fi
run_at_dev() {
dev="$1"
[ -c "$dev" ] || return 1
out="$(timeout 2 awk -v dev="$dev" -v cmd="$at_cmd" '
BEGIN {
sys = "stty -F " dev " raw -echo 115200 min 0 time 2 2>/dev/null"
system(sys)
printf "%s\r\n", cmd > dev
close(dev)
}
' 2>/dev/null || true)"
return 0
}
resp=""
for candidate in "$port" wwan0at1 wwan0at0; do
case "$candidate" in
wwan0at0|wwan0at1)
dev="/dev/$candidate"
if [ -c "$dev" ]; then
resp="$(timeout 2 sh -c '
dev="$1"
cmd="$2"
stty -F "$dev" raw -echo 115200 min 0 time 2 2>/dev/null || true
exec 3<>"$dev"
dd bs=256 count=4 status=none <&3 >/dev/null 2>&1 || true
printf "%s\r\n" "$cmd" >&3
lines=""
i=0
while [ "$i" -lt 8 ]; do
chunk="$(dd bs=512 count=1 status=none <&3 2>/dev/null | tr -d "\r" || true)"
if [ -n "$chunk" ]; then
lines="${lines}${chunk}"
case "$lines" in
*OK*|*ERROR*)
break
;;
esac
fi
i=$((i + 1))
done
exec 3>&-
printf "%s\n" "$lines"
' _ "$dev" "$at_cmd" 2>/dev/null | sed '/^[[:space:]]*$/d' || true)"
if [ -n "$resp" ]; then
printf "%s\n" "$resp"
exit 0
fi
fi
;;
esac
[ "$port" != "auto" ] && [ "$candidate" = "$port" ] && break
done
mm_out="$(mmcli -m any --command="$at_cmd" 2>&1 || true)"
if [ -n "$mm_out" ]; then
printf "%s\n" "$mm_out" | sed "s/^response: '\(.*\)'$/\1/"
exit 0
fi
echo "ERROR: No response from modem AT channel"
exit 1
;;
*)
echo "Usage: $0 [boot|status|switch <1|2>|verify-pin <slot> <pin>|unblock-puk <slot> <puk> <newpin>|set-pin-lock <slot> <enable|disable> <pin>|change-pin <slot> <oldpin> <newpin>]" >&2
echo "Usage: $0 [boot|status|switch <1|2>|verify-pin <slot> <pin>|unblock-puk <slot> <puk> <newpin>|set-pin-lock <slot> <enable|disable> <pin>|change-pin <slot> <oldpin> <newpin>|imei|usb-tether <on|off|status>|at <port> <cmd>]" >&2
exit 1
;;
esac
@@ -11,78 +11,86 @@
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
if [ -f "$XDG_CONFIG_HOME/sxmo/ringsettings" ]; then
# shellcheck disable=SC1091
. "$XDG_CONFIG_HOME/sxmo/ringsettings"
fi
if [ -f "$XDG_CONFIG_HOME/sxmo/ringtone" ]; then
custom_ring="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/ringtone" 2>/dev/null)"
if [ -n "$custom_ring" ] && [ -f "$custom_ring" ]; then
SXMO_RINGTONE="$custom_ring"
fi
fi
# Only vibrate if you already got an active call
if sxmo_modemcall.sh list_active_calls \
| grep -v ringing-in \
| grep -q .; then
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}"
exit
| grep -v ringing-in \
| grep -q .; then
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}"
exit
fi
# Shallow if you have more than one ringing call
if ! sxmo_modemcall.sh list_active_calls \
| grep -c ringing-in \
| grep -q 1; then
exit
| grep -c ringing-in \
| grep -q 1; then
exit
fi
finish() {
trap - INT TERM EXIT
jobs -p | xargs -r kill
wait
exit
trap - INT TERM EXIT
jobs -p | xargs -r kill
wait
exit
}
ring() {
mpv --no-resume-playback --quiet --no-video \
--loop="${SXMO_RINGNUMBER:-10}" "$SXMO_RINGTONE" >/dev/null &
mpv --no-resume-playback --quiet --no-video \
--loop="${SXMO_RINGNUMBER:-10}" "$SXMO_RINGTONE" >/dev/null &
}
vibrate() {
while : ; do
trap 'finish' INT TERM EXIT
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}" &
wait "$!"
while : ; do
trap 'finish' INT TERM EXIT
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}" &
wait "$!"
sleep 0.5 &
wait "$!"
done &
sleep 0.5 &
wait "$!"
done &
}
# SILENT MODE
if [ -f "$XDG_CONFIG_HOME"/sxmo/.busy ]; then
end="$(cat "$XDG_CONFIG_HOME"/sxmo/.busy)"
if [ -z "$end" ] || [ "$(date +%s)" -lt "$end" ]; then
exit
fi
end="$(cat "$XDG_CONFIG_HOME"/sxmo/.busy)"
if [ -z "$end" ] || [ "$(date +%s)" -lt "$end" ]; then
exit
fi
fi
# RING & VIBRATE MODE (DEFAULT)
if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
sxmo_log "RING AND VIBRATE"
sxmo_log "RING AND VIBRATE"
# In order for this to work, you will need to install playerctl and run playerctld
# In order for this to work with mpv, you will need to install mpv-mdis.
sxmo_playerctl.sh pause_all
sxmo_playerctl.sh pause_all
ring
vibrate
ring
vibrate
# RING-ONLY MODE
elif [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
sxmo_log "RING ONLY"
sxmo_log "RING ONLY"
# In order for this to work, you will need to install playerctl and run playerctld
# In order for this to work with mpv, you will need to install mpv-mdis.
sxmo_playerctl.sh pause_all
sxmo_playerctl.sh pause_all
ring
ring
# VIBRATE-ONLY MODE
elif [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ] && [ -f "$XDG_CONFIG_HOME"/sxmo/.noring ]; then
smxo_log "VIBRATE ONLY"
sxmo_log "VIBRATE ONLY"
vibrate
vibrate
fi
trap 'finish' INT TERM EXIT
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB