1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 18:25:07 +00:00
serenity/Ports/neofetch/patches/add-serenity-support.patch
Andreas Kling def1f1444a WindowServer: Move configuration file to /etc/WindowServer.ini
This was in the /etc/WindowServer/ directory which had nothing else in
it, so let's just get rid of the directory and move this up one step.
2021-04-29 22:16:18 +02:00

247 lines
8.6 KiB
Diff

--- neofetch-7.1.0/neofetch 2021-01-29 22:24:13.954000000 +0100
+++ neofetch-7.1.0/neofetch 2021-01-29 22:25:14.498712940 +0100
@@ -794,7 +794,7 @@
# popos, Porteus, PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix,
# Raspbian, Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan,
# Regata, Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific,
-# Septor, SereneLinux, SharkLinux, Siduction, Slackware, SliTaz,
+# Septor, SereneLinux, SerenityOS, SharkLinux, Siduction, Slackware, SliTaz,
# SmartOS, Solus, Source_Mage, Sparky, Star, SteamOS, SunOS,
# openSUSE_Leap, openSUSE_Tumbleweed, openSUSE, SwagArch, Tails,
# Trisquel, Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio,
@@ -929,6 +929,7 @@
AIX) os=AIX ;;
IRIX*) os=IRIX ;;
FreeMiNT) os=FreeMiNT ;;
+ SerenityOS) os=SerenityOS ;;
Linux|GNU*)
os=Linux
@@ -1185,6 +1186,10 @@
FreeMiNT)
distro=FreeMiNT
;;
+
+ SerenityOS)
+ distro=SerenityOS
+ ;;
esac
distro=${distro//Enterprise Server}
@@ -1356,7 +1361,7 @@
get_kernel() {
# Since these OS are integrated systems, it's better to skip this function altogether
- [[ $os =~ (AIX|IRIX) ]] && return
+ # [[ $os =~ (AIX|IRIX) ]] && return
# Haiku uses 'uname -v' and not - 'uname -r'.
[[ $os == Haiku ]] && {
@@ -1377,17 +1382,17 @@
esac
# Hide kernel info if it's identical to the distro info.
- [[ $os =~ (BSD|MINIX) && $distro == *"$kernel_name"* ]] &&
- case $distro_shorthand in
- on|tiny) kernel=$kernel_version ;;
- *) unset kernel ;;
- esac
+ # [[ $os =~ (BSD|MINIX) && $distro == *"$kernel_name"* ]] &&
+ # case $distro_shorthand in
+ # on|tiny) kernel=$kernel_version ;;
+ # *) unset kernel ;;
+ # esac
}
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 @@
off) shell="${SHELL##*/} " ;;
esac
+ [[ "$os" == SerenityOS ]] && shell="SerenityOS Shell"
+
[[ $shell_version != on ]] && return
case ${shell_name:=${SHELL##*/}} in
@@ -2096,13 +2103,13 @@
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"
# Select the right temperature file.
- for temp_dir in /sys/class/hwmon/*; do
- [[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power|k10temp) ]] && {
- temp_dirs=("$temp_dir"/temp*_input)
- temp_dir=${temp_dirs[0]}
- break
- }
- done
+ # for temp_dir in /sys/class/hwmon/*; do
+ # [[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power|k10temp) ]] && {
+ # temp_dirs=("$temp_dir"/temp*_input)
+ # temp_dir=${temp_dirs[0]}
+ # break
+ # }
+ # done
# Get CPU speed.
if [[ -d "$speed_dir" ]]; then
@@ -2268,6 +2275,13 @@
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` 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.
+ ;;
esac
# Remove un-needed patterns from cpu output.
@@ -2646,6 +2660,15 @@
mem_used="$((mem_used / 1024))"
;;
+ "SerenityOS")
+ memstat="$(cat /proc/memstat)"
+ user_physical_allocated="$(echo $memstat | jq .user_physical_allocated)"
+ user_physical_available="$(echo $memstat | jq .user_physical_available)"
+ mem_used="$((user_physical_allocated * 4096 / 1024 / 1024))"
+ mem_free="$((user_physical_available * 4096 / 1024 / 1024))"
+ mem_total="$((mem_used + mem_free))"
+ ;;
+
esac
[[ "$memory_percent" == "on" ]] && ((mem_perc=mem_used * 100 / mem_total))
@@ -2980,6 +3003,13 @@
# Fix weird output when the function is run multiple times.
unset gtk2_theme gtk3_theme theme path
+ if [[ "$os" == "SerenityOS" ]]; then
+ theme=$(ini /etc/WindowServer.ini Theme Name)
+ if [ -z "$theme" ]; then
+ theme="Default"
+ fi
+ fi
+
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 @@
xfconf="/Net/IconThemeName"
kde="Theme"
- get_style
- icons="$theme"
+ icons=
}
get_font() {
@@ -3158,6 +3187,8 @@
*) term="${TERM_PROGRAM/\.app}" ;;
esac
+ [[ "$os" == SerenityOS ]] && term="SerenityOS Terminal"
+
# Most likely TosWin2 on FreeMiNT - quick check
[[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && term="TosWin2"
[[ "$SSH_CONNECTION" ]] && term="$SSH_TTY"
@@ -3722,10 +3753,10 @@
}
get_public_ip() {
- if type -p dig >/dev/null; then
- public_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com)"
- [[ "$public_ip" =~ ^\; ]] && unset public_ip
- fi
+ # if type -p dig >/dev/null; then
+ # public_ip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com)"
+ # [[ "$public_ip" =~ ^\; ]] && unset public_ip
+ # fi
if [[ -z "$public_ip" ]] && type -p drill >/dev/null; then
public_ip="$(drill myip.opendns.com @resolver1.opendns.com | \
@@ -3871,13 +3902,13 @@
}
print_ascii() {
- if [[ -f "$image_source" && ! "$image_source" =~ (png|jpg|jpeg|jpe|svg|gif) ]]; then
- ascii_data="$(< "$image_source")"
- elif [[ "$image_source" == "ascii" || $image_source == auto ]]; then
- :
- else
- ascii_data="$image_source"
- fi
+ # if [[ -f "$image_source" && ! "$image_source" =~ (png|jpg|jpeg|jpe|svg|gif) ]]; then
+ # ascii_data="$(< "$image_source")"
+ # elif [[ "$image_source" == "ascii" || $image_source == auto ]]; then
+ # :
+ # else
+ # ascii_data="$image_source"
+ # fi
# Set locale to get correct padding.
LC_ALL="$sys_locale"
@@ -4650,8 +4681,8 @@
padding=${xrdb/*internalBorder:}
padding=${padding/$'\n'*}
- [[ $padding =~ ^[0-9]+$ ]] ||
- padding=
+ # [[ $padding =~ ^[0-9]+$ ]] ||
+ # padding=
;;
esac
}
@@ -4936,7 +4967,7 @@
Porteus, PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix,
Raspbian, Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan,
Regata, Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific,
- Septor, SereneLinux, SharkLinux, Siduction, Slackware, SliTaz,
+ Septor, SereneLinux, SerenityOS, SharkLinux, Siduction, Slackware, SliTaz,
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 @@
EOF
;;
+ "SerenityOS"*)
+ set_colors 3 1 7 8 15
+ read -rd '' ascii_data <<'EOF'
+${c4} _ __
+ / o \ ,^ _ `\
+ \./ ] | /* /
+${c5} - *~ .#_ ${c4}`--`
+${c5} ,` ' "w
+${c5} ]` / ]${c4}Kp
+${c5} B 'M %m ]${c4}KK
+ K${c5}p \ #${c4}KKH
+ KK${c5}N,,,w,__,#${c4}KKK
+ `KKK${c2}\KKKKK${c4}KKK${c3}KK${c4}${c2}KNw${c4}
+ #R${c3}K${c4}K${c3}\KK${c4}gKKKH${c3}L5${c4}${c2}KK${c4}K
+ ]K${c3}|a${c4}#KKKKKBKNp${c3}LI${c4}${c2}K${c4}KN
+ .K${c3}K${c4}KDKBKBBKKKKKKN${c3}]${c4}${c2}KK${c4}
+${c2} ]K${c3}IMK${c4}KBKKKKKKKK${c3}RMI${c4}${c2}KKH${c4}
+${c2} ]K${c3}I${c4}#KkBBBBBBKKKKN${c3}I${c4}${c2}KK${c4}
+${c2} ]K${c3}[K${c4}KKBKKKKKKKKM${c3}*]${c4}KK
+ `KN${c3}|1${c4}KKKKKKKBKM${c3}`L${c4}KKM
+ `KN${c3},|]${c4}KKKKK${c3}/|L;${c4}${c2}#${c4}KK
+ `--KKK KK${c2}KKKKK${c4}
+ aaNKKKaKK ${c2}`${c4}
+ KKKKKKKKM
+ ````
+EOF
+ ;;
+
"SharkLinux"*)
set_colors 4 7
read -rd '' ascii_data <<'EOF'