Added fastfetch "rice"

Removed the useless options

Added extremely useful option, NIC. NIC lets you show those filthy
peasants that their network interface is simply too frail compared to
your magnum connection. Everytime you start a file transfer, thousands
of poor gigabit users cry out in agony as their files get bottlenecked
by their inferior wire. Each iperf tests makes the ground tremble with
the immense power that you wield. Everyone will praise you for having
such a fast connection. You'll finally be the life of the party, man
of the hour, even truely find the love of your life. Together you can
raise a family, a family that knows not the horrors of a
sub-multigigabit connection, but rather the bliss of Earth shattering
network speeds.
This commit is contained in:
Logan G 2024-06-08 18:47:51 -06:00
parent bed1987ea4
commit 7ed85da9bb
Signed by: logan
GPG key ID: E328528C921E7A7A
3 changed files with 97 additions and 0 deletions

2
.config/.gitignore vendored
View file

@ -60,6 +60,8 @@
!river/**
!kak/
!kak/**
!fastfetch/
!fastfetch/**
!.gitignore
polybar/default

View file

@ -0,0 +1,38 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"modules": [
"title",
"separator",
"os",
"host",
"kernel",
"uptime",
"packages",
"shell",
"display",
"de",
"wm",
"wmtheme",
"theme",
"icons",
"font",
"cursor",
"editor",
"terminal",
"cpu",
"gpu",
"memory",
"swap",
"disk",
{
"type": "command",
"shell": "/usr/bin/bash",
"text": "~/.config/fastfetch/nic.sh",
"key": "NIC"
},
"battery",
"poweradapter",
"break",
"colors"
]
}

57
.config/fastfetch/nic.sh Executable file
View file

@ -0,0 +1,57 @@
#!/bin/bash
set -e
# Get the default route
default_route=$(ip route | grep default)
# Extract the NIC interface name
nic=$(echo $default_route | awk '{print $5}')
# Get current link speed of interface
link_speed=$(ethtool $nic 2>/dev/null | grep "Speed:" | awk '{print $2}')
# Get the PCI ID for the NIC interface
pci_id=$(ethtool -i $nic 2>/dev/null | grep bus-info | awk '{print $2}')
# Extract speed and unit
speed_value=$(echo $link_speed | sed 's/[A-Za-z\/]*//g')
speed_unit=$(echo $link_speed | sed 's/[0-9]*//g')
# Convert speed to a human-readable format
case $speed_unit in
"Mb/s")
if [ $speed_value -ge 1000 ]; then
speed_value=$(bc <<< "scale=1; $speed_value/1000")
speed_unit="Gb/s"
fi
;;
"Gb/s")
# If you need to handle more units, you can extend here
;;
*)
#echo "Unknown speed unit: $speed_unit"
speed_value=""
speed_unit=""
;;
esac
# Check if PCI ID is found
if [ -z "$pci_id" ]; then
#echo "PCI ID not found for interface: $nic"
exit 1
else
# Get the human-readable name of the device
device_name=$(lspci -s $pci_id | cut -d ' ' -f 4-)
fi
# Hee Hoo jank :)
if [[ ! -z $speed_value && ! -z $speed_unit ]]; then
speed_value="[${speed_value}"
speed_unit="${speed_unit}]"
else
speed_value=""
speed_unit=""
fi
echo "$device_name" "${speed_value} ${speed_unit}"