diff --git a/Ports/neofetch/patches/0001-Add-support-for-serenity.patch b/Ports/neofetch/patches/0001-Add-support-for-serenity.patch index fc59e58877..c79b9df3c8 100644 --- a/Ports/neofetch/patches/0001-Add-support-for-serenity.patch +++ b/Ports/neofetch/patches/0001-Add-support-for-serenity.patch @@ -1,16 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Linus Groh -Date: Sat, 14 Aug 2021 13:33:46 -0400 +From: Liav A +Date: Tue, 25 Oct 2022 22:06:54 +0300 Subject: [PATCH] Add support for serenity Co-Authored-By: Andreas Kling Co-Authored-By: Nico Weber +Co-Authored-By: Linus Groh --- - neofetch | 121 +++++++++++++++++++++++++++++++++++++++++-------------- - 1 file changed, 90 insertions(+), 31 deletions(-) + neofetch | 130 ++++++++++++++++++++++++++++++++++++++++++------------- + 1 file changed, 100 insertions(+), 30 deletions(-) diff --git a/neofetch b/neofetch -index 1e4b564..d2a12cd 100755 +index 1e4b56462a08dd1ea27fcb21acc6da22f9b6a477..3c111b3207a2abd8107553d353dde9ba42f7bd82 100755 --- a/neofetch +++ b/neofetch @@ -794,7 +794,7 @@ image_source="auto" @@ -50,7 +51,7 @@ index 1e4b564..d2a12cd 100755 # Haiku uses 'uname -v' and not - 'uname -r'. [[ $os == Haiku ]] && { -@@ -1377,17 +1382,17 @@ get_kernel() { +@@ -1377,11 +1382,11 @@ get_kernel() { esac # Hide kernel info if it's identical to the distro info. @@ -67,14 +68,25 @@ index 1e4b564..d2a12cd 100755 } get_uptime() { - # Get uptime in seconds. - case $os in -- Linux|Windows|MINIX) -+ Linux|Windows|MINIX|SerenityOS) - if [[ -r /proc/uptime ]]; then - s=$(< /proc/uptime) - s=${s/.*} -@@ -1628,6 +1633,8 @@ get_shell() { +@@ -1398,6 +1403,17 @@ get_uptime() { + fi + ;; + ++ SerenityOS) ++ if [[ -r /sys/kernel/uptime ]]; then ++ s=$(< /sys/kernel/uptime) ++ s=${s/.*} ++ else ++ boot=$(date -d"$(uptime -s)" +%s) ++ now=$(date +%s) ++ s=$((now - boot)) ++ fi ++ ;; ++ + "Mac OS X"|"macOS"|"iPhone OS"|BSD|FreeMiNT) + boot=$(sysctl -n kern.boottime) + boot=${boot/\{ sec = } +@@ -1628,6 +1644,8 @@ get_shell() { off) shell="${SHELL##*/} " ;; esac @@ -83,7 +95,7 @@ index 1e4b564..d2a12cd 100755 [[ $shell_version != on ]] && return case ${shell_name:=${SHELL##*/}} in -@@ -2096,13 +2103,13 @@ get_cpu() { +@@ -2096,13 +2114,13 @@ get_cpu() { speed_dir="/sys/devices/system/cpu/cpu0/cpufreq" # Select the right temperature file. @@ -104,13 +116,13 @@ index 1e4b564..d2a12cd 100755 # Get CPU speed. if [[ -d "$speed_dir" ]]; then -@@ -2268,6 +2275,13 @@ get_cpu() { +@@ -2268,6 +2286,13 @@ get_cpu() { cpu="$(awk -F':' '/CPU:/ {printf $2}' /kern/cpuinfo)" speed="$(awk -F '[:.M]' '/Clocking:/ {printf $2}' /kern/cpuinfo)" ;; + + "SerenityOS") -+ cpu="$(jq -r '.[0].brandstr' /proc/cpuinfo)" ++ cpu="$(jq -r '.[0].brand' /sys/kernel/cpuinfo)" + # `cpu` will contain "@ [speed]GHz" and to be super correct we + # have to cut that off and store it in `speed` only for neofetch + # to append it again later - but that's fine for now this way. @@ -118,12 +130,12 @@ index 1e4b564..d2a12cd 100755 esac # Remove un-needed patterns from cpu output. -@@ -2646,6 +2660,15 @@ get_memory() { +@@ -2646,6 +2671,15 @@ get_memory() { mem_used="$((mem_used / 1024))" ;; + "SerenityOS") -+ memstat="$(cat /proc/memstat)" ++ memstat="$(cat /sys/kernel/memstat)" + physical_allocated="$(echo $memstat | jq .physical_allocated)" + physical_available="$(echo $memstat | jq .physical_available)" + mem_used="$((physical_allocated * 4096 / 1024 / 1024))" @@ -134,7 +146,7 @@ index 1e4b564..d2a12cd 100755 esac [[ "$memory_percent" == "on" ]] && ((mem_perc=mem_used * 100 / mem_total)) -@@ -2980,6 +3003,13 @@ get_style() { +@@ -2980,6 +3014,13 @@ get_style() { # Fix weird output when the function is run multiple times. unset gtk2_theme gtk3_theme theme path @@ -148,7 +160,7 @@ index 1e4b564..d2a12cd 100755 if [[ "$DISPLAY" && $os != "Mac OS X" && $os != "macOS" ]]; then # Get DE if user has disabled the function. ((de_run != 1)) && get_de -@@ -3130,8 +3160,7 @@ get_icons() { +@@ -3130,8 +3171,7 @@ get_icons() { xfconf="/Net/IconThemeName" kde="Theme" @@ -158,7 +170,7 @@ index 1e4b564..d2a12cd 100755 } get_font() { -@@ -3158,6 +3187,8 @@ get_term() { +@@ -3158,6 +3198,8 @@ get_term() { *) term="${TERM_PROGRAM/\.app}" ;; esac @@ -167,7 +179,7 @@ index 1e4b564..d2a12cd 100755 # Most likely TosWin2 on FreeMiNT - quick check [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && term="TosWin2" [[ "$SSH_CONNECTION" ]] && term="$SSH_TTY" -@@ -3722,10 +3753,10 @@ get_local_ip() { +@@ -3722,10 +3764,10 @@ get_local_ip() { } get_public_ip() { @@ -182,7 +194,7 @@ index 1e4b564..d2a12cd 100755 if [[ -z "$public_ip" ]] && type -p drill >/dev/null; then public_ip="$(drill myip.opendns.com @resolver1.opendns.com | \ -@@ -3871,13 +3902,13 @@ image_backend() { +@@ -3871,13 +3913,13 @@ image_backend() { } print_ascii() { @@ -203,7 +215,7 @@ index 1e4b564..d2a12cd 100755 # Set locale to get correct padding. LC_ALL="$sys_locale" -@@ -4650,8 +4681,8 @@ term_padding() { +@@ -4650,8 +4692,8 @@ term_padding() { padding=${xrdb/*internalBorder:} padding=${padding/$'\n'*} @@ -214,7 +226,7 @@ index 1e4b564..d2a12cd 100755 ;; esac } -@@ -4936,7 +4967,7 @@ ASCII: +@@ -4936,7 +4978,7 @@ ASCII: Porteus, PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix, Raspbian, Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan, Regata, Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific, @@ -223,7 +235,7 @@ index 1e4b564..d2a12cd 100755 SmartOS, Solus, Source_Mage, Sparky, Star, SteamOS, SunOS, openSUSE_Leap, openSUSE_Tumbleweed, openSUSE, SwagArch, Tails, Trisquel, Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio, -@@ -9513,6 +9544,34 @@ ${c1} __---''''''---__ +@@ -9513,6 +9555,34 @@ ${c1} __---''''''---__ EOF ;;