Fix for incorrect memory utilization, and various copilot suggestions. Removed code providing unreliable detection of the terminal application

This commit is contained in:
Joanna 2026-03-08 17:32:26 +00:00
parent d2e9da734f
commit 7dc5f79d8c
4 changed files with 12 additions and 10 deletions

View File

@ -1124,9 +1124,9 @@ def detect(name: str) -> AsciiArt | None:
from .q4os import q4os
return q4os
if name.startswith('blackberry 10') or name.startswith('qnx'):
from .blackberry_10 import blackberry_10
return blackberry_10
if name.startswith('qnx') or name.startswith('blackberry 10'):
from .qnx import qnx
return qnx
if name.startswith('qubes'):
from .qubes import qubes

View File

@ -2,7 +2,7 @@
from . import AsciiArt
q4os = AsciiArt(match=r'''"Blackberry 10"* | "QNX"*''', color='1', ascii=r"""
qnx = AsciiArt(match=r'''"QNX"* | "Blackberry 10"*''', color='1', ascii=r"""
${c1} .KMMMMMbo .KMMMMMbo
aMMMMMMMMb aMMMMMMMMb
,KMMMMMMMMp ,KMMMMMMMMp
@ -18,3 +18,4 @@ AMMMMMMMP* AMMMMMMMP* .KMMMMMbo
,KMMMMMMMMp
AMMMMMMMP*
""")

View File

@ -1528,6 +1528,7 @@ get_distro() {
QNX)
distro=$(cat /pps/services/deviceproperties | awk -F'::' '$1 == "device_os" { print $2 }')
distro="${distro} ($(cat /base/etc/os.version))"
;;
esac
distro=${distro//Enterprise Server}
@ -1876,6 +1877,7 @@ get_model() {
QNX)
model=$(cat /pps/services/deviceproperties | awk -F'::' '/modelname/ {m=$2} /modelnumber/ {n=$2} END {print m" ("n")"}')
;;
esac
# Remove dummy OEM info.
@ -3810,13 +3812,13 @@ get_memory() {
mem_free="$(( $(showmem -f) * 1000 ))"
mem_used="$(( $(showmem -u) * 1000 ))"
mem_total="$(( $(showmem -t) * 1000 ))"
;;
"QNX")
mem_used="$(( $(pidin info | sed -n 's/.*FreeMem:\([0-9][0-9]*\)MB\/.*/\1/p') * 1024 ))"
mem_free="$(( $(pidin info | sed -n 's/.*FreeMem:\([0-9][0-9]*\)MB\/.*/\1/p') * 1024 ))"
mem_total="$(( $(pidin info | sed -n 's|.*MB/||;s|MB Boot.*||p') * 1024 ))"
mem_used="$((mem_total - mem_free))"
;;
esac
@ -4663,8 +4665,6 @@ get_term() {
*) term="${TERM_PROGRAM/\.app}" ;;
esac
[[ $os == QNX ]] && term="$(pidin session 2> /dev/null | awk 'NR==2 {n=split($NF, a, "/"); print a[n]}')"
# Most likely TosWin2 on FreeMiNT - quick check
[[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && term="TosWin2"
[[ "$SSH_CONNECTION" ]] && term="$SSH_TTY"
@ -13448,7 +13448,7 @@ ${c1}:##############. ${c2}:======:
EOF
;;
"Blackberry 10"* | "QNX"*)
"QNX"* | "Blackberry 10"*)
set_colors 1
read -rd '' ascii_data <<'EOF'
${c1} .KMMMMMbo .KMMMMMbo

View File

@ -26,10 +26,11 @@ classifiers = [
dependencies = [
# Universal dependencies
'typing_extensions; python_version < "3.8"',
# Windows dependencies
'psutil ; platform_system=="Windows"',
'colorama>=0.4.6 ; platform_system=="Windows"',
"regex>=2024.4.16",
"hypy-utils>=1.0.29",
]
[project.urls]