Add support for QNX/Blackberry 10 (#480)

* Add support for QNX 8.x/Blackberry 10

* Maybe the real uptime was the friends we made along the way

* Detect name of the terminal application

* Re-run the list distros script

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

* Apply suggestion from @Copilot

Ignore header lines for qpkg package manager

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove erroneous dependencies

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Joanna Hartley 2026-04-07 02:10:05 +01:00 committed by GitHub
parent e5ba2b3be9
commit 9500e8c0aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 99 additions and 3 deletions

View File

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

21
hyfetch/distros/qnx.py Normal file
View File

@ -0,0 +1,21 @@
# This file is automatically generated. Please do not modify.
from . import AsciiArt
qnx = AsciiArt(match=r'''"QNX"* | "Blackberry 10"*''', color='1', ascii=r"""
${c1} .KMMMMMbo .KMMMMMbo
aMMMMMMMMb aMMMMMMMMb
,KMMMMMMMMp ,KMMMMMMMMp
AMMMMMMMP* AMMMMMMMP* ,KMMMMMbo
aMMMMMMMMb
.KMMMMMbo .KMMMMMbo .KMMMMMMMMp
aMMMMMMMMb aMMMMMMMMb AMMMMMMMP*
,KMMMMMMMMp .KMMMMMMMMp
AMMMMMMMP* AMMMMMMMP* .KMMMMMbo
aMMMMMMMMb
.KMMMMMbo ,KMMMMMMMMp
aMMMMMMMMb AMMMMMMMP*
,KMMMMMMMMp
AMMMMMMMP*
""")

View File

@ -891,7 +891,7 @@ image_source="auto"
# Tumbleweed, openSUSE Tumbleweed-Slowroll, OPNsense, Oracle, orchid, OS Elbrus, PacBSD, Panwah,
# Parabola, parch, Pardus, Parrot, Parsix, PCBSD, PCLinuxOS, pearOS, Pengwin, Pentoo, Peppermint,
# Peropesis, phyOS, PikaOS, Pisi, PNM Linux, Pop!_OS, Porteus, PostMarketOS, Profelis SambaBOX,
# Proxmox, PuffOS, Puppy, PureOS, Q4OS, Qubes, Qubyt, Quibian, Radix, Raspbian, ravynOS, Reborn OS,
# Proxmox, PuffOS, Puppy, PureOS, Q4OS, QNX, Qubes, Qubyt, Quibian, Radix, Raspbian, ravynOS, Reborn OS,
# Red Star, Redcore, Redhat, Refracted Devuan, Regata, Regolith, RhaymOS, Rhino Linux, rocky, Rosa,
# Sabayon, sabotage, Sailfish, SalentOS, Salient OS, Salix, Sasanqua, Scientific, secureblue, semc,
# Septor, Serene, SharkLinux, ShastraOS, Siduction, SkiffOS, Slackel, Slackware, SliTaz, SmartOS,
@ -1046,6 +1046,7 @@ get_os() {
Interix) os=Interix ;;
Ironclad) os=Ironclad;;
OSF1) os=digitalUNIX ;;
QNX) os=QNX ;;
Linux|GNU*)
os=Linux
@ -1523,6 +1524,11 @@ get_distro() {
digitalUNIX)
distro="digital UNIX ${kernel_version}"
;;
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}
@ -1531,7 +1537,7 @@ get_distro() {
# Get OS architecture.
case $os in
Solaris|illumos|AIX|Haiku|IRIX|FreeMiNT|BSD|digitalUNIX)
Solaris|illumos|AIX|Haiku|IRIX|FreeMiNT|BSD|digitalUNIX|QNX)
machine_arch=$(uname -p)
;;
@ -1868,6 +1874,10 @@ get_model() {
model="${model/Manufacturer}"
model="${model/Model}"
;;
QNX)
model=$(cat /pps/services/deviceproperties | awk -F'::' '/modelname/ {m=$2} /modelnumber/ {n=$2} END {print m" ("n")"}')
;;
esac
# Remove dummy OEM info.
@ -2022,6 +2032,13 @@ get_uptime() {
Haiku)
s=$(($(system_time) / 1000000))
;;
QNX)
boot=$(date -d "$(pidin info | sed -n 's/.*BootTime:\([^$]*\)/\1/p')" +%s)
now=$(date +%s)
s=$((now - boot))
;;
esac
d="$((s / 60 / 60 / 24)) days"
@ -2402,6 +2419,11 @@ get_packages() {
manager=swpkg
pkgs_h=3 tot versions -b && ((packages-=3))
;;
QNX)
has qpkg && pkgs_h=4 tot qpkg list && ((packages-=4))
has apk && tot apk info
;;
esac
# Count the total number of packages.
@ -3358,6 +3380,17 @@ END
cores="$(/dev/fs/C/Windows/System32/wbem/WMIC.exe cpu get NumberOfCores)"
cores="${cores/NumberOfCores}"
;;
"QNX")
# Get CPU name
cpu="$(uname -m | cut -d '_' -f 1)"
# Get CPU speed
speed="$(pidin info | grep -o '[0-9]\+MHz' | head -1 | tr -d 'MHz')"
# Get CPU cores
cores="$(pidin info | grep -c '^Processor[0-9]')"
;;
esac
# Remove un-needed patterns from cpu output.
@ -3779,6 +3812,14 @@ get_memory() {
mem_free="$(( $(showmem -f) * 1000 ))"
mem_used="$(( $(showmem -u) * 1000 ))"
mem_total="$(( $(showmem -t) * 1000 ))"
;;
"QNX")
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
[[ "$memory_percent" == "on" ]] && ((mem_perc=mem_used * 100 / mem_total))
@ -4211,6 +4252,10 @@ get_resolution() {
# Need to block X11 queries
;;
"QNX")
resolution=$(cat /pps/services/deviceproperties | awk -F'::' '$1 == "screen_res" { print $2 }')
;;
*)
if type -p xrandr >/dev/null && [[ $DISPLAY && -z $WAYLAND_DISPLAY ]]; then
case $refresh_rate in
@ -5245,6 +5290,12 @@ get_battery() {
battery0now="$(awk -F '[^0-9]*' 'NR==5 {print $4}' /dev/power/acpi_battery/0)"
battery="$((battery0full * 100 / battery0now))%"
;;
"QNX")
battery="$(cat /pps/system/BattMgr/status | sed -n 's/.*"StateOfCharge":\([0-9]*\).*/\1/p')%"
state="$(cat /pps/system/BattMgr/status | sed -n 's/.*"ChargerStatus":"\([^"]*\)".*/\1/p' )"
[[ "$state" == "CHARGING" ]] && battery_state="charging"
;;
esac
[[ "$battery_state" ]] && battery+=" Charging"
@ -6674,7 +6725,7 @@ ASCII:
OS Elbrus, PacBSD, Panwah, Parabola, parch, Pardus, Parrot, Parsix,
PCBSD, PCLinuxOS, pearOS, Pengwin, Pentoo, Peppermint, Peropesis,
phyOS, PikaOS, Pisi, PNM Linux, Pop!_OS, Porteus, PostMarketOS,
Profelis SambaBOX, Proxmox, PuffOS, Puppy, PureOS, Q4OS, Qubes,
Profelis SambaBOX, Proxmox, PuffOS, Puppy, PureOS, Q4OS, QNX, Qubes,
Qubyt, Quibian, Radix, Raspbian, ravynOS, Reborn OS, Red Star,
Redcore, Redhat, Refracted Devuan, Regata, Regolith, RhaymOS, Rhino
Linux, rocky, Rosa, Sabayon, sabotage, Sailfish, SalentOS, Salient
@ -13397,6 +13448,26 @@ ${c1}:##############. ${c2}:======:
EOF
;;
"QNX"* | "Blackberry 10"*)
set_colors 1
read -rd '' ascii_data <<'EOF'
${c1} .KMMMMMbo .KMMMMMbo
aMMMMMMMMb aMMMMMMMMb
,KMMMMMMMMp ,KMMMMMMMMp
AMMMMMMMP* AMMMMMMMP* ,KMMMMMbo
aMMMMMMMMb
.KMMMMMbo .KMMMMMbo .KMMMMMMMMp
aMMMMMMMMb aMMMMMMMMb AMMMMMMMP*
,KMMMMMMMMp .KMMMMMMMMp
AMMMMMMMP* AMMMMMMMP* .KMMMMMbo
aMMMMMMMMb
.KMMMMMbo ,KMMMMMMMMp
aMMMMMMMMb AMMMMMMMP*
,KMMMMMMMMp
AMMMMMMMP*
EOF
;;
"Qubes"*)
set_colors 4 5 7 6
read -rd '' ascii_data <<'EOF'