From 216aa61b82afa681a5a023678ad6152008ad1c42 Mon Sep 17 00:00:00 2001 From: stuffbymax <96355058+stuffbymax@users.noreply.github.com> Date: Tue, 23 Jul 2024 18:09:27 +0100 Subject: [PATCH] Add files via upload --- README.md | 10 +- install.sh | 17 ++- sysi | 426 ++++++++++++++++++++++++++++------------------------- 3 files changed, 241 insertions(+), 212 deletions(-) diff --git a/README.md b/README.md index 9932ecf..f48cab8 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,19 @@ # people who would prefer to stay anonymous that helped. - mz provided get_percentage stuff and set -u set -e set -o pipefail - sy pointed that storage % was on right - - tg helped a lot mz helped a lot and sy helped a lot i just cant remember + - tg helped a lot mz helped a lot and sy helped a lot # people that helped - BluishHumility fixed the ai problem - DsturbD pointed the nerd-font problem +[this section is made by BluishHumility # sysi Script README written by AI ---- - +] # what i use AI for * readme @@ -31,7 +32,6 @@ To run `sysi` without issues, ensure the following: 1. **Operating System**: - Linux-based operating system (e.g., Ubuntu, Fedora, Debian, Arch). - 1.5 **fonts** - nerd font needed - get nerd font https://www.nerdfonts.com/ @@ -123,7 +123,7 @@ Install necessary utilities using your package manager. Examples: | **CPU Cores/Threads** | No | Yes | | **Fan Speeds** | No | Yes (if lm_sensors installed) | | **GPU Info** | Yes | Yes | -| **GPU Temperatures** | No | Yes (Nvidia, AMD, Intel GPUs and if lm_sensors installed) | +| **GPU Temperatures** | No | Yes (Nvidia, AMD, Intel GPUs) | | **Memory Info** | Yes | Yes | | **Disk Usage** | Yes | Yes | | **Battery Info** | Yes | Yes | @@ -135,7 +135,7 @@ Install necessary utilities using your package manager. Examples: |**disk I/O statistics:** | no | yes | | **Firewall Information** | no | yes | | **Customization** | High (config file) | High (script editing) | -| **Ease of Use** | High (simple command) | High (simple command) | +| **Ease of Use** | High (simple command) | Moderate (run script manually) | ## Neofetch diff --git a/install.sh b/install.sh index 9ca9d76..dd8ce5c 100644 --- a/install.sh +++ b/install.sh @@ -22,9 +22,6 @@ install_packages() { arch|endeavouros|manjaro) yay -S --noconfirm "${packages[@]}" ;; - opensuse) - sudo zypper install -y "${packages[@]}" - ;; *) echo "Unsupported distribution: $distribution" exit 1 @@ -44,6 +41,12 @@ get_distribution() { fi } +# Function to install Iosevka Nerd Font using yay on Arch-based distributions +install_nerdfont_arch() { + echo "Installing Iosevka Nerd Font..." + sudo pacman -S ttf-iosevkaterm-nerd +} + # Function to install Iosevka Nerd Font based on distribution install_nerdfont() { local distribution=$1 @@ -55,10 +58,7 @@ install_nerdfont() { sudo dnf install -y iosevka-fonts ;; arch|endeavouros|manjaro) - sudo pacman -S --noconfirm ttf-iosevka-nerd - ;; - opensuse) - sudo zypper install -y fonts-iosevka-nerd + install_nerdfont_arch ;; *) echo "Unsupported distribution: $distribution" @@ -84,7 +84,7 @@ if [[ ${#missing_deps[@]} -gt 0 ]]; then distribution=$(get_distribution) case $distribution in - debian|ubuntu|arch|endeavouros|manjaro|fedora|opensuse) + debian|ubuntu|arch|endeavouros|manjaro|fedora) install_packages "$distribution" "${missing_deps[@]}" ;; *) @@ -110,3 +110,4 @@ sudo chmod +x /usr/local/bin/sysi echo "SYSI installation completed." echo "You can now run 'sysi' to display system information." + diff --git a/sysi b/sysi index feef744..2de8d1a 100644 --- a/sysi +++ b/sysi @@ -1,78 +1,36 @@ #!/bin/bash set -u -# Function to add colors + + + +# Function to add colors to text color_text() { local color=$1 local text=$2 - case $color in - "black") - echo -e "\033[40m${text}\033[0m" ;; - "red") - echo -e "\033[31m${text}\033[0m" ;; - "green") - echo -e "\033[32m${text}\033[0m" ;; - "yellow") - echo -e "\033[33m${text}\033[0m" ;; - "blue") - echo -e "\033[34m${text}\033[0m" ;; - "magenta") - echo -e "\033[35m${text}\033[0m" ;; - "cyan") - echo -e "\033[36m${text}\033[0m" ;; - "white") - echo -e "\033[37m${text}\033[0m" ;; - "bright_black") - echo -e "\033[90m${text}\033[0m" ;; - "bright_red") - echo -e "\033[91m${text}\033[0m" ;; - "bright_green") - echo -e "\033[92m${text}\033[0m" ;; - "bright_yellow") - echo -e "\033[93m${text}\033[0m" ;; - "bright_blue") - echo -e "\033[94m${text}\033[0m" ;; - "bright_magenta") - echo -e "\033[95m${text}\033[0m" ;; - "bright_cyan") - echo -e "\033[96m${text}\033[0m" ;; - "bright_white") - echo -e "\033[97m${text}\033[0m" ;; - "bg_black") - echo -e "\033[40m${text}\033[0m" ;; - "bg_red") - echo -e "\033[41m${text}\033[0m" ;; - "bg_green") - echo -e "\033[42m${text}\033[0m" ;; - "bg_yellow") - echo -e "\033[43m${text}\033[0m" ;; - "bg_blue") - echo -e "\033[44m${text}\033[0m" ;; - "bg_magenta") - echo -e "\033[45m${text}\033[0m" ;; - "bg_cyan") - echo -e "\033[46m${text}\033[0m" ;; - "bg_white") - echo -e "\033[47m${text}\033[0m" ;; - "bg_bright_black") - echo -e "\033[100m${text}\033[0m" ;; - "bg_bright_red") - echo -e "\033[101m${text}\033[0m" ;; - "bg_bright_green") - echo -e "\033[102m${text}\033[0m" ;; - "bg_bright_yellow") - echo -e "\033[103m${text}\033[0m" ;; - "bg_bright_blue") - echo -e "\033[104m${text}\033[0m" ;; - "bg_bright_magenta") - echo -e "\033[105m${text}\033[0m" ;; - "bg_bright_cyan") - echo -e "\033[106m${text}\033[0m" ;; - "bg_bright_white") - echo -e "\033[107m${text}\033[0m" ;; - *) - echo "$text" ;; - esac + + # ANSI color codes + declare -A colors=( + ["black"]="\033[30m" ["red"]="\033[31m" ["green"]="\033[32m" + ["yellow"]="\033[33m" ["blue"]="\033[34m" ["magenta"]="\033[35m" + ["cyan"]="\033[36m" ["white"]="\033[37m" ["bright_black"]="\033[90m" + ["bright_red"]="\033[91m" ["bright_green"]="\033[92m" ["bright_yellow"]="\033[93m" + ["bright_blue"]="\033[94m" ["bright_magenta"]="\033[95m" ["bright_cyan"]="\033[96m" + ["bright_white"]="\033[97m" ["bg_black"]="\033[40m" ["bg_red"]="\033[41m" + ["bg_green"]="\033[42m" ["bg_yellow"]="\033[43m" ["bg_blue"]="\033[44m" + ["bg_magenta"]="\033[45m" ["bg_cyan"]="\033[46m" ["bg_white"]="\033[47m" + ["bg_bright_black"]="\033[100m" ["bg_bright_red"]="\033[101m" + ["bg_bright_green"]="\033[102m" ["bg_bright_yellow"]="\033[103m" + ["bg_bright_blue"]="\033[104m" ["bg_bright_magenta"]="\033[105m" + ["bg_bright_cyan"]="\033[106m" ["bg_bright_white"]="\033[107m" + ) + + # Output the colored text, or an error message if the color is not found + if [[ ${colors[$color]} ]]; then + echo -e "${colors[$color]}${text}\033[0m" + else + echo "Color '$color' not recognized." + fi } @@ -91,6 +49,10 @@ center_text() { done <<< "$text" } + + + + # Function to calculate percentage get_percentage() { used=$1 @@ -98,76 +60,6 @@ get_percentage() { awk -v used="$used" -v total="$total" 'BEGIN { printf("%.2f%%", (used / total) * 100) }' } -# Function to display a random quote -display_quote() { - quotes=( - "Talk is cheap. Show me the code. - Linus Torvalds" - "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. - Linus Torvalds" - "Free software is software that respects your freedom and the social solidarity of your community. So it's free as in freedom. - Richard Stallman" - "Control over the use of one's ideas really constitutes control over other people's lives; and it is usually used to make their lives more difficult. - Richard Stallman" - "Given enough eyeballs, all bugs are shallow. - Eric S. Raymond" - "The next best thing to having good ideas is recognizing good ideas from your users. Sometimes the latter is better. - Eric S. Raymond" - "The Web as I envisaged it, we have not seen it yet. The future is still so much bigger than the past. - Tim Berners-Lee" - "The only way to make software secure, reliable, and fast is to put it out in the public domain and let people attack it, play with it, and break it. - Brian Behlendorf" - "I believe that openness is the key to creativity and innovation. - Mitchell Baker" - "May the Force be with you. -Star Wars (many characters)" - "Knowledge is power. -Sir Francis Bacon" - "Information flow is what the Internet is about. Information sharing is power. If you dont share your ideas smart people cant do anything about them and your all remain anonymous and powerless. -Vint cerf" - "When we have welcoming communities of contributors, open source software gets better and more useful to everyone. -Limor Fried" - "Open source is about collaborating; not competing. -Kelesey Hightower" - ) - random_index=$((RANDOM % ${#quotes[@]})) - center_text "$(color_text "cyan" "Random Quote: ${quotes[$random_index]}")" -} - - -# Function to display a random programming joke -display_joke() { - jokes=( - "Why do programmers prefer dark mode? Because light attracts bugs!" - "There are 10 types of people in the world: those who understand binary and those who don't." - "A SQL statement walks into a bar and sees two tables. It approaches, and asks, 'May I join you?'" - "Why do Java developers wear glasses? Because they don't see sharp." - "How many programmers does it take to change a light bulb? None. It's a hardware problem." - "your mama so fat 32 she cant store file over 4 GB" - "your mama so ugly she turn sdd into flopy" - "Knock, knock. Who’s There? Very long pause… Java." - "Things aren’t always #000000 and #FFFFFF" - "Why do Java programmers have to wear glasses? Because they don’t C#" - "There’s no place like 127.0.0.1" - "My love for you has no bugs" - "Real programmers count from 0" - "while (alive) { eat(); sleep (); code ();}" - "Binary: It’s as easy as 01, 10, 11" - ) - random_index=$((RANDOM % ${#jokes[@]})) - center_text "$(color_text "magenta" "Joke of the Day: ${jokes[$random_index]}")" -} - - -# Function to display a random fun fact -display_fun_fact() { - facts=( - "The first computer bug was an actual bug: a moth stuck in a Harvard Mark II in 1947." - "The first 1GB hard drive, announced in 1980, weighed over 500 pounds and cost 40000." - "The first computer virus was created in 1983 by Fred Cohen as part of his PhD thesis." - "The first programming language was Ada Lovelace's algorithm for Charles Babbage's Analytical Engine." - "The first webcam was used to monitor a coffee pot at the University of Cambridge." - "The first computer mouse was made of wood." - "The Firefox logo isnt a fox. is Red panda." - "Nintendo made playing cards." - "As of 2017, 2.1 millions people still use dial up." - "Google's First Tweet was in binary" - "Motorola produced the first handheld mobile phone." - "YouTube uploads 72 hours of video every single minute. " - "The First Computer Weighed More Than 24,493.988 KG/27 Tons." - "The C Language was not called C at the beginning" - - ) - random_index=$((RANDOM % ${#facts[@]})) - center_text "$(color_text "yellow" "Fun Fact: ${facts[$random_index]}")" -} - # Get memory and swap usage details memory_usage=$(free -h --si | awk '/^Mem/ {print $3 " / " $2}') swap_usage=$(free -h --si | awk '/^Swap/ {print $3 " / " $2}') @@ -203,101 +95,120 @@ display_logo() { # Function to display system information including GPU temperatures display_info() { os=$(awk -F= '/^PRETTY_NAME=/{print $2}' /etc/os-release | tr -d '"') - center_text "$(color_text "green" " Operating System: $os")" + center_text "$(color_text "bg_green" " Operating System")" + center_text "$(color_text "bright_white" "$os")" echo"" - center_text "$(color_text "green" " Host: $(cat /proc/sys/kernel/hostname)")" + center_text "$(color_text "bg_green" " Host")" + center_text "$(color_text "bright_white" "$(cat /proc/sys/kernel/hostname)")" echo"" - center_text "$(color_text "green" " Model: $(cat /sys/devices/virtual/dmi/id/board_{name,vendor} | awk '!(NR%2){print$1,p}{p=$0}')")" + center_text "$(color_text "bg_green" " Model")" + center_text "$(color_text "bright_white" "$(cat /sys/devices/virtual/dmi/id/board_{name,vendor} | awk '!(NR%2){print$1,p}{p=$0}')")" echo"" - center_text "$(color_text "green" " Logged-in Users:")" + center_text "$(color_text "bg_yellow" " Logged-in Users")" center_text "$(w)" echo"" - center_text "$(color_text "green" " Kernel Name: $(uname -s)")" + center_text "$(color_text "bg_yellow" " Kernel Name")" + center_text "$(color_text "bright_white" "$(uname -s)")" echo"" - center_text "$(color_text "green" "\e[33m Kernel Version:\e[0m $(uname -r)")" + center_text "$(color_text "bg_yellow" " Kernel Version")" + center_text "$(color_text "bright_white" "$(uname -r)")" echo"" - center_text "$(color_text "green" "\e[33m Kernel Release:\e[0m $(uname -v)")" + center_text "$(color_text "bg_yellow" " Kernel Release \e[0m")" + center_text "$(uname -v)" echo"" - center_text "$(color_text "green" " Kernel Architecture: $(uname -m)")" + center_text "$(color_text "bg_yellow" " Kernel Architecture")" + center_text "$(color_text "bright_white" "$(uname -m)")" echo"" - center_text "$(color_text "green" " Uptime:\e[0m $(uptime -p)")" + center_text "$(color_text "bg_white" " Uptime")" + center_text "$(color_text "bg_blue" "\e[0m $(uptime -p)")" echo"" - center_text "$(color_text "green" " Clock/Time: $(date '+%Y-%m-%d %H:%M:%S')")" + center_text "$(color_text "bg_white" " Clock/Time")" + center_text "$(color_text "white" "\e[0m $(date '+%Y-%m-%d %H:%M:%S')")" echo"" - center_text "$(color_text "green" " Packages: $(get_package_count)")" + center_text "$(color_text "bg_bright_black" " Packages: $(get_package_count)")" echo"" - center_text "$(color_text "green" " Resolution: $(xrandr | grep -i "*" )")" + center_text "$(color_text "bg_bright_black" " Resolution")" + center_text "$(color_text "bright_white" "\e[0m $(xrandr | grep -i "*" )")" echo"" - center_text "$(color_text "green" " Machine Hardware Platform: $(uname -i)")" + center_text "$(color_text "bg_bright_black" " Machine Hardware Platform")" + center_text "$(color_text "bg_white" "\e[0m $(uname -i)")" + echo"" + center_text "$(color_text "bg_bright_black" " Processor Type")" + + center_text "$(color_text "bg_bright_black" "\e[0m $(uname -p)")" echo"" - center_text "$(color_text "green" " Processor Type: $(uname -p)")" - center_text "$(color_text "green" " CPU:\e[0m $(grep "model name" /proc/cpuinfo | cut -d ' ' -f 3- | uniq)")" + center_text "$(color_text "bg_blue" " CPU")" + center_text "$(color_text "bg_blue" "\e[0m $(grep "model name" /proc/cpuinfo | cut -d ' ' -f 3- | uniq)")" echo"" - center_text "$(color_text "green" " CPU Cores: $(awk '/^cpu cores/ {print $4; exit}' /proc/cpuinfo)")" + center_text "$(color_text "bg_blue" " CPU Cores")" + center_text "$(color_text "bg_blue" "\e[0m $(awk '/^cpu cores/ {print $4; exit}' /proc/cpuinfo)")" echo"" - center_text "$(color_text "green" " CPU Threads: $(awk '/^processor/ {count++} END {print count}' /proc/cpuinfo)")" + center_text "$(color_text "bg_blue" " CPU Threads")" + center_text "$(color_text "bg_blue" "\e[0m $(awk '/^processor/ {count++} END {print count}' /proc/cpuinfo)")" echo"" - center_text "$(color_text "green" " Fan Speeds:$(sensors | grep -i 'fan' | awk '{print " ", $1, $2, $3, $4}')")" + center_text "$(color_text "bg_blue" " Fan Speeds")" + center_text "$(color_text "bg_blue" "\e[0m$(sensors | grep -i 'fan' | awk '{print " ", $1, $2, $3, $4}')")" echo"" if command -v sensors &> /dev/null; then - center_text "$(color_text "green" " CPU Temperature:")" + center_text "$(color_text "bg_bright_blue" " CPU Temperature")" # Collect all lines containing "Core" from sensors output core_lines=$(sensors | grep "Core") # Iterate over each line and center it while IFS= read -r line; do - center_text "$(color_text "red" "$line")" + center_text "$(color_text "bg_white" "$line")" done <<< "$core_lines" else - center_text "$(color_text "green" " CPU Temperature: Not available (lm_sensors not installed)")" + center_text "$(color_text "bg_red" " CPU Temperature: Not available (lm_sensors not installed)")" fi echo "" - center_text "$(color_text "green" " GPU: $(lspci | grep VGA | cut -d ':' -f 3 | cut -d '[' -f 1,2 | sed 's/^ *//')")" + center_text "$(color_text "bg_bright_black" " GPU")" + center_text "$(color_text "bg_bright_black" "\e[0m $(lspci | grep VGA | cut -d ':' -f 3 | cut -d '[' -f 1,2 | sed 's/^ *//')")" echo"" if ! command -v sensors &> /dev/null; then center_text "$(color_text "red" "lmsensors not installed")" else gpu_temp=$(sensors | grep -i 'gpu') if [ -z "$gpu_temp" ]; then - center_text "$(color_text "red" " No GPU temperature data available")" + center_text "$(color_text "bg_bright_red" " No GPU temperature data available")" else - center_text "$(color_text "green" " GPU Temperatures:" "$gpu_temp")" + center_text "$(color_text "bg_bright_black" " GPU Temperatures:" "$gpu_temp")" fi fi echo "" - center_text "$(color_text "green" " Memory: ($memory_percentage) ($memory_usage)")" + center_text "$(color_text "bg_bright_magenta" " Memory: ($memory_percentage) ($memory_usage)")" echo"" - center_text "$(color_text "green" " Swap: ($swap_percentage) ($swap_usage)")" + center_text "$(color_text "bg_bright_magenta" " Swap: ($swap_percentage) ($swap_usage)")" echo"" local disk_usage=$(df -h / | awk 'NR==2 {print "(" $5 " used) " $3 "/" $2 }') - center_text "$(color_text "green" " Disk Usage: ${disk_usage}")" + center_text "$(color_text "bg_bright_black" " Disk Usage: ${disk_usage}")" echo"" local battery_info=$(upower -i $(upower -e | grep BAT) | grep --color=never -E "state|to full|percentage") - center_text "$(color_text "green" " Battery:")" + center_text "$(color_text "bg_bright_black" " Battery:")" while IFS= read -r line; do center_text "$line" done <<< "$battery_info" echo"" - center_text "$(color_text "green" " Top Processes by CPU Usage:")" + center_text "$(color_text "bg_cyan" " Top Processes by CPU Usage")" ps -eo pid,%cpu,%mem,cmd --sort=-%cpu | head -n 11 | while IFS= read -r line; do center_text "$line" done echo "" - center_text "$(color_text "green" " Top Processes by Memory Usage:")" + center_text "$(color_text "bg_cyan" " Top Processes by Memory Usage")" ps -eo pid,%cpu,%mem,cmd --sort=-%mem | head -n 11 | while IFS= read -r line; do center_text "$line" done echo "" - center_text "$(color_text "green" " Disk I/O Statistics:")" + center_text "$(color_text "bg_yellow" " Disk I/O Statistics")" local io_stats=$(iostat) while IFS= read -r line; do center_text "$line" done <<< "$io_stats" - center_text "$(color_text "green" " Mounted Drives:")" - local header="$(color_text "green" " Filesystem Size Used Use%")" + center_text "$(color_text "bg_bright_black" " Mounted Drives")" + local header="$(color_text "bg_blue" " Filesystem Size Used Use%")" center_text "$header" local drives=$(df -h | awk 'NR>1 {printf " %-30s %-10s %-10s %-10s\n", $1, $2, $3, $5}') while IFS= read -r line; do @@ -309,36 +220,36 @@ else # [network] # Display Network Interfaces -# center_text "$(color_text "yellow" " Network Interfaces:")" +# center_text "$(color_text "bg_yellow" " Network Interfaces:")" # ip addr show | sed 's/^/ /' # [gpu] # Display GPU temperatures for Nvidia, AMD, and Intel GPUs if available -# center_text "$(color_text "yellow" " GPU Temperatures:")" +# center_text "$(color_text "bg_yellow" " GPU Temperatures:")" # Check and display Nvidia GPU temperature # if command -v nvidia-smi &> /dev/null; then -# center_text "$(color_text "yellow" " Nvidia:")" +# center_text "$(color_text "bg_yellow" " Nvidia:")" # nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader | awk '{print " ", $1, "°C"}' # fi # Check and display AMD GPU temperature # if command -v radeontop &> /dev/null; then -# center_text "$(color_text "yellow" " AMD:")" +# center_text "$(color_text "bg_yellow" " AMD:")" # radeontop -l1 | grep "Temperature" | sed 's/^/ /' # fi # Check and display Intel GPU temperature # if command -v intel_gpu_top &> /dev/null; then -# center_text "$(color_text "yellow" " Intel:")" +# center_text "$(color_text "bg_yellow" " Intel:")" # intel_gpu_top -s 1 | awk '/Rendering/ {print " ", $7, "°C"}' # fi # [logs] # Display System Logs (last 20 lines of syslog) -# center_text "$(color_text "yellow" " System Logs (last 20 lines of syslog):")" +# center_text "$(color_text "bg_yellow" " System Logs (last 20 lines of syslog):")" # tail -n 20 /var/log/syslog | sed 's/^/ /' @@ -346,47 +257,138 @@ else # Display Uptime -# center_text "$(color_text "yellow" " Uptime:") $(uptime)" +# center_text "$(color_text "bg_yellow" " Uptime:") $(uptime)" # [shell] # Display Shell -# center_text "$(color_text "green" " Shell:") $SHELL" +# center_text "$(color_text "bg_green" " Shell:") $SHELL" # [firewall] # Display Firewall Information - #center_text "$(color_text "yellow" " Firewall Information:")" - #center_text "$(color_text "yellow" " UFW Status:")" + #center_text "$(color_text "bg_yellow" " Firewall Information:")" + #center_text "$(color_text "bg_yellow" " UFW Status:")" #ufw status verbose | sed 's/^/ /' # Adjust format as needed for your system's output - #center_text "$(color_text "yellow" " IPTables Rules:")" + #center_text "$(color_text "bg_yellow" " IPTables Rules:")" #iptables -L -v -n | sed 's/^/ /' # Adjust format as needed for your system's output - #center_text "$(color_text "yellow" " Firewalld Zones and Services:")" + #center_text "$(color_text "bg_yellow" " Firewalld Zones and Services:")" #firewall-cmd --list-all-zones | sed 's/^/ /' # Adjust format as needed for your system's output - #center_text "$(color_text "yellow" " Nftables Rules:")" + #center_text "$(color_text "bg_yellow" " Nftables Rules:")" #nft list ruleset | sed 's/^/ /' # Adjust format as needed for your system's output # [resolution] # Display Resolution - #center_text "$(color_text "yellow" " Resolution:") $(hwinfo --monitor)" + #center_text "$(color_text "bg_yellow" " Resolution:") $(hwinfo --monitor)" } +# Function to display a random quote +display_quote() { + quotes=( + "Talk is cheap. Show me the code. - Linus Torvalds" + "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. - Linus Torvalds" + "Free software is software that respects your freedom and the social solidarity of your community. So it's free as in freedom. - Richard Stallman" + "Control over the use of one's ideas really constitutes control over other people's lives; and it is usually used to make their lives more difficult. - Richard Stallman" + "Given enough eyeballs, all bugs are shallow. - Eric S. Raymond" + "The next best thing to having good ideas is recognizing good ideas from your users. Sometimes the latter is better. - Eric S. Raymond" + "The Web as I envisaged it, we have not seen it yet. The future is still so much bigger than the past. - Tim Berners-Lee" + "The only way to make software secure, reliable, and fast is to put it out in the public domain and let people attack it, play with it, and break it. - Brian Behlendorf" + "I believe that openness is the key to creativity and innovation. - Mitchell Baker" + "May the Force be with you. -Star Wars (many characters)" + "Knowledge is power. -Sir Francis Bacon" + "Information flow is what the Internet is about. Information sharing is power. If you dont share your ideas smart people cant do anything about them and your all remain anonymous and powerless. -Vint cerf" + "When we have welcoming communities of contributors, open source software gets better and more useful to everyone. -Limor Fried" + "Open source is about collaborating; not competing. -Kelesey Hightower" + ) + random_index=$((RANDOM % ${#quotes[@]})) + center_text "$(color_text "bg_cyan" "Random Quote: ${quotes[$random_index]}")" +} + + +# Function to display a random programming joke +display_joke() { + jokes=( + "Why do programmers prefer dark mode? Because light attracts bugs!" + "There are 10 types of people in the world: those who understand binary and those who don't." + "A SQL statement walks into a bar and sees two tables. It approaches, and asks, 'May I join you?'" + "Why do Java developers wear glasses? Because they don't see sharp." + "How many programmers does it take to change a light bulb? None. It's a hardware problem." + "your mama so fat 32 she cant store file over 4 GB" + "your mama so ugly she turn sdd into flopy" + "Knock, knock. Who’s There? Very long pause… Java." + "Things aren’t always #000000 and #FFFFFF" + "Why do Java programmers have to wear glasses? Because they don’t C#" + "There’s no place like 127.0.0.1" + "My love for you has no bugs" + "Real programmers count from 0" + "while (alive) { eat(); sleep (); code ();}" + "Binary: It’s as easy as 01, 10, 11" + ) + random_index=$((RANDOM % ${#jokes[@]})) + center_text "$(color_text "bg_magenta" "Joke of the Day: ${jokes[$random_index]}")" +} + + +# Function to display a random fun fact +display_fun_fact() { + facts=( + "The first computer bug was an actual bug: a moth stuck in a Harvard Mark II in 1947." + "The first 1GB hard drive, announced in 1980, weighed over 500 pounds and cost 40000." + "The first computer virus was created in 1983 by Fred Cohen as part of his PhD thesis." + "The first programming language was Ada Lovelace's algorithm for Charles Babbage's Analytical Engine." + "The first webcam was used to monitor a coffee pot at the University of Cambridge." + "The first computer mouse was made of wood." + "The Firefox logo isnt a fox. is Red panda." + "Nintendo made playing cards." + "As of 2017, 2.1 millions people still use dial up." + "Google's First Tweet was in binary" + "Motorola produced the first handheld mobile phone." + "YouTube uploads 72 hours of video every single minute. " + "The First Computer Weighed More Than 24,493.988 KG/27 Tons." + "The C Language was not called C at the beginning" + + ) + random_index=$((RANDOM % ${#facts[@]})) + center_text "$(color_text "bg_yellow" "Fun Fact: ${facts[$random_index]}")" +} + get_package_count() { local package_count="N/A" - if command -v dpkg-query &> /dev/null; then - package_count=$(dpkg-query -f '${binary:Package}\n' -W 2>/dev/null | wc -l) - elif command -v rpm &> /dev/null; then - package_count=$(rpm -qa 2>/dev/null | wc -l) - elif command -v pacman &> /dev/null; then - package_count=$(pacman -Q 2>/dev/null | wc -l) - fi +if command -v dpkg >/dev/null 2>&1; then + pkgs=$(dpkg -l | grep '^ii' | wc -l) + source="(dpkg)" +elif command -v pacman >/dev/null 2>&1; then + pkgs=$(pacman -Q | wc -l) + source="(pacman)" +elif command -v equo >/dev/null 2>&1; then + pkgs=$(equo query list installed -q | wc -l) + source="(equo)" +elif command -v eopkg >/dev/null 2>&1; then + pkgs=$(eopkg list-installed | wc -l) + source="(eopkg)" +elif command -v tce-status >/dev/null 2>&1; then + pkgs=$(tce-status -i | wc -l) + source="(tce-status)" +elif command -v apk >/dev/null 2>&1; then + pkgs=$(apk info | wc -l) + source="(apk)" +elif command -v xbps-query >/dev/null 2>&1; then + pkgs=$(xbps-query -l | wc -l) + source="(xbps-query)" +elif command -v emerge >/dev/null 2>&1; then + pkgs=$(qlist -I | wc -l) + source="(emerge)" +elif command -v rpm >/dev/null 2>&1; then + pkgs=$(rpm -qa | wc -l) + source="(rpm)" +fi - echo "$package_count" + echo "$pkgs" "$source" } # Function to get information about various themes @@ -407,22 +409,48 @@ get_theme_info() { # Display themes using center_text function - center_text "$(color_text "green" "GTK Theme: $gtk_theme")" - center_text "$(color_text "green" "Icon Theme: $icon_theme")" - center_text "$(color_text "green" "Cursor Theme: $cursor_theme")" + center_text "$(color_text "bg_red" "GTK Theme: $gtk_theme")" + center_text "$(color_text "bg_green" "Icon Theme: $icon_theme")" + center_text "$(color_text "bg_blue" "Cursor Theme: $cursor_theme")" + + + } + # Easter egg for ASUSTeK model get_model() { model=$(cat /sys/devices/virtual/dmi/id/board_{name,vendor} | awk '!(NR%2){print$1,p}{p=$0}') if [[ "$model" == *"ASUSTeK"* ]]; then echo "" - center_text "$(color_text "black" "Easter Egg: Asus more like ASSUS")" + center_text "$(color_text "bg_bright_black" "Asus more like ASSUS")" fi } + +czef() { + #Define the colored blocks for the Czech flag +c1=$(color_text "bg_white" " ") # White background +c2=$(color_text "bg_red" " ") # Red background +c3=$(color_text "bg_blue" " ") # Blue background + +# Center and print the Czech flag +echo "" +center_text "$c1" +center_text "$c1" +center_text "$c1" +center_text "$c2" +center_text "$c2" +center_text "$c2" +center_text "$c3" +center_text "$c3" +center_text "$c3" +echo "" +} + + # Main function to display output main() { clear @@ -433,7 +461,7 @@ main() { display_quote display_joke display_fun_fact - + czef } # Execute main function