2025-06-14 17:17:10 -05:00

279 lines
11 KiB
Bash
Executable File

#!/bin/sh
# ==== Desktop Environment Bloat Detector ====
detect_de() {
# Hierarchy of shame
echo "🖥️ DESKTOP ENVIRONMENT ANALYSIS:"
# ==== Tier 1: Chromium-Level Bloat ====
if [ -n "$GNOME_DESKTOP_SESSION_ID" ] || pgrep -x "gnome-shell" >/dev/null; then
echo " ☢️ GNOME DETECTED:"
echo " - 1.2GB RAM just to display a clock"
echo " - Systemd-required for 'OK' button animations"
echo " - Your extensions are duct tape on a sinking blimp"
elif [ -n "$KDE_FULL_SESSION" ] || pgrep -x "plasmashell" >/dev/null; then
echo " 🎪 KDE PLASMA DETECTED:"
echo " - 300 configuration options for your taskbar's tooltip delay"
echo " - Ships with 17 text editors (kate, kwrite, kedit...)"
echo " - 'Lightweight' like a neutron star"
# ==== Tier 2: "Minimal" Bloat ====
elif [ -n "$HYPRLAND_INSTANCE_SIGNATURE" ] || pgrep -x "Hyprland" >/dev/null; then
echo " 🐍 HYPRLAND DETECTED:"
echo " - Requires 200-line config just to open Firefox"
echo " - 'GPU accelerated' but stutters on 4K terminals"
echo " - Your animations are powered by copium"
elif [ -n "$SWAYSOCK" ] || pgrep -x "sway" >/dev/null; then
echo " 🌊 SWAY DETECTED:"
echo " - 'i3 but Wayland' (somehow 3x heavier)"
echo " - Your config file has 15 binds just for workspace switching"
echo " - Still depends on systemd (lol)"
elif pgrep -x "i3" >/dev/null; then
echo " 🧊 I3 DETECTED:"
echo " - Config file longer than your thesis"
echo " - 'Lightweight' but requires 5 daemons for notifications"
echo " - You manually patched gaps support and now it's slower than GNOME"
# ==== Tier 3: Respectable Minimalism ====
elif pgrep -x "lxqt-session" >/dev/null; then
echo " 🏗️ LXQT DETECTED:"
echo " - Basically Qt for people who miss 2010"
echo " - Somehow still depends on DBus"
echo " - The 'I almost switched to dwm' starter pack"
elif pgrep -x "lxsession" >/dev/null; then
echo " 🚲 LXDE DETECTED:"
echo " - GTK2 in 2024 (retro computing vibe)"
echo " - Last updated when Bitcoin was $200"
echo " - Actually runs on a Raspberry Pi (points for honesty)"
# ==== Tier 4: Ascended Basedness ====
elif pgrep -x "dwm" >/dev/null; then
echo " 🚀 DWM DETECTED:"
echo " - Config? You mean editing config.h and recompiling?"
echo " - 2000 lines of C just to avoid a .config file"
echo " - You patched in systray support and now it's 0.0001% less based"
elif pgrep -x "xmonad" >/dev/null; then
echo " λ XMONAD DETECTED:"
echo " - Haskell-powered tiling (because C wasn't obscure enough)"
echo " - Your xmobar config is a Turing-complete program"
echo " - 'Lightweight' but depends on 47 Haskell libraries"
# ==== Tier 5: Terminal Purists ====
elif [ "$TERM" = "linux" ] && [ -z "$DISPLAY" ]; then
echo " 🖴 TTY DETECTED:"
echo " - Real men use framebuffer terminals"
echo " - Your 'desktop environment' is tmux + ncurses"
echo " - 100% bloat-free (but you still miss mouse support)"
else
echo " ❓ MYSTERY DE:"
echo " - Did you install Enlightenment by accident?"
echo " - Or are you lying about using CDE?"
fi
}
# System info
init_system=$(ps -p 1 -o comm=)
libc=$(ldd /bin/sh 2>/dev/null | grep -q "musl" && echo "musl" || echo "glibc")
priv=$(command -v doas >/dev/null && echo "doas" || (command -v sudo >/dev/null && echo "sudo" || echo "none"))
dbus_status=$(pgrep -x dbus-daemon >/dev/null && echo "running" || (command -v dbus-daemon >/dev/null && echo "installed" || echo "absent"))
shell=$(basename "${SHELL:-$(grep "^$(id -u):" /etc/passwd | cut -d: -f7)}")
# Coreutils detection
if readlink --version 2>&1 | grep -q 'GNU coreutils'; then
coreutils="GNU coreutils"
coreutils_shame="💀 CRIMES AGAINST MINIMALISM: Using GNU coreutils (bloated, 102 binaries, huge size). Use sbase/busybox."
elif readlink --help 2>&1 | head -n1 | grep -q 'BusyBox'; then
coreutils="BusyBox"
coreutils_shame="✅ Based: BusyBox user detected (1MB static binary)."
else
coreutils="Unknown"
coreutils_shame="❓ Mystery coreutils. Probably worse than GNU."
fi
# ===== Package Manager Detection =====
echo "System: $(source /etc/os-release; echo "$PRETTY_NAME")"
if command -v xbps-query >/dev/null; then
# Void Linux
total=$(xbps-query -l | wc -l)
conscious=$(xbps-query -m | wc -l)
gnu=$(xbps-query -s gnu | wc -l)
elif command -v pacman >/dev/null; then
# Arch Linux
total=$(pacman -Qq | wc -l)
conscious=$(pacman -Qqen | wc -l)
gnu=$(pacman -Qqs gnu | wc -l)
elif command -v dpkg >/dev/null; then
# Debian/Ubuntu
total=$(dpkg -l | grep '^ii' | wc -l)
conscious=$(apt-mark showmanual | wc -l)
gnu=$(apt-mark showmanual | grep -i gnu | wc -l)
elif command -v rpm >/dev/null && command -v dnf >/dev/null; then
# Fedora/RHEL
total=$(rpm -qa | wc -l)
conscious=$(dnf history userinstalled | grep -v '^ID' | wc -l)
gnu=$(yum list --installed | wc -l)
else
echo "Error: Unsupported package manager"
return 1
fi
# ===== Application Shame Detection =====
echo "🔴 SHAME LIST:"
# 1. GNU Coreutils
[ "$coreutils" = "GNU coreutils" ] && echo " - $coreutils_shame"
# 2. glibc
[ "$libc" = "glibc" ] && echo " - 💀 GLIBC DETECTED: Your binaries are fat with NSS+locale bloat. Use musl."
# 3. systemd
[ "$init_system" = "systemd" ] && echo " - 💀 SYSTEMD: Your boot is slower than Windows 10. Use runit/openrc."
# 4. dbus/elogind/pulseaudio
if [ "$dbus_status" != "absent" ]; then
echo " - 💀 DBUS: Your IPC is a Rube Goldberg machine. Try seatd+pipewire."
fi
command -v pulseaudio >/dev/null && echo " - 💀 PULSEAUDIO: Audio stack from 2007. PipeWire exists."
# 5. Bash/Zsh
case "$shell" in
*bash*) echo " - 💀 BASH: 1.5MB shell for people who autocomplete 'sudo rm -rf'" ;;
*zsh*) echo " - 💀 ZSH: Your .zshrc is 200 lines to change the prompt" ;;
*dash*) echo " - ✅ Based: dash user (100KB POSIX shell)" ;;
*ash*) echo " - ✅ Based: ash/busybox shell enjoyer" ;;
esac
# 6. Build systems
command -v cmake >/dev/null && echo " - 💀 CMAKE: Your build system generates Makefiles that generate Ninja files that run shell scripts"
command -v meson >/dev/null && echo " - 🐍 MESON: 'We replaced CMake with Python' (why?)"
# 7. sudo vs doas
[ "$priv" = "sudo" ] && echo " - 💀 SUDO: 5MB config parser with CVEs. doas is 50KB."
[ "$priv" = "none" ] && echo " - ⚠️ No privilege escalator found. Are you root or reckless?"
# ===== Flatpak/Snap/Distrobox Detection =====
flatpak_bloat=0
snap_bloat=0
if command -v flatpak >/dev/null; then
flatpak_bloat=$(flatpak list --columns=application | wc -l)
echo "🚀 Flatpak Detected:"
echo "Total Flatpaks : $flatpak_bloat"
echo "Top 5 Largest:"
flatpak list --columns=application,size | sort -k2 -hr | head -n5 | sed 's/^/ /'
[ $flatpak_bloat -gt 0 ] && echo " - 💀 FLATPAK: Your apps ship with their own copies of glibc (from 2018)"
fi
if command -v snap >/dev/null; then
snap_bloat=$(snap list | wc -l)
echo "🐦 Snap Detected:"
echo "Total Snaps : ${snap_bloat}"
echo "Top 5 Largest:"
snap list --all | awk 'NR>1 {print $1,$5}' | sort -k2 -hr | head -n5 | sed 's/^/ /'
[ $snap_bloat -gt 0 ] && echo " - 💀 SNAP: Congratulations on your 20GB /var/lib/snapd"
fi
# GIGACHAD Distrobox Bloat Inspector
# Checks your containers and roasts them appropriately
# 100% POSIX-compliant Distrobox Bloat Inspector
# No numfmt, no bashisms, no weak dependencies
bytes_to_human() {
bytes=$1
if [ "$bytes" -ge 1073741824 ]; then
printf "%.1fGiB" "$(echo "$bytes / 1073741824" | bc -l)"
elif [ "$bytes" -ge 1048576 ]; then
printf "%.1fMiB" "$(echo "$bytes / 1048576" | bc -l)"
elif [ "$bytes" -ge 1024 ]; then
printf "%dKiB" "$((bytes / 1024))"
else
printf "%dB" "$bytes"
fi
}
# Ultra-minimalist Distrobox Bloat Checker
# POSIX-compliant, dependency-free (except distrobox/docker)
echo "📦 Distrobox Containers Found:"
distrobox-list | tail -n +2 | while IFS='|' read -r id name status _; do
name=$(echo "$name" | xargs)
status=$(echo "$status" | xargs)
case "$status" in
Up*) echo " 🚀 $name: RUNNING (stop wasting RAM)" ;;
Exited*) echo " 💀 $name: DEAD (but still wasting disk space)" ;;
*) echo "$name: WEIRD STATE ('$status')" ;;
esac
done
# ===== Fedora Special Shame =====
if [[ "$distro_name" == *"Fedora"* ]]; then
echo "🐄 FEDORA USER DETECTED:"
echo " - Enjoy your 300MB 'dnf' transactions"
echo " - SELinux is judging you right now"
echo " - OpenBSD is more secure LMAO"
echo " - Your /usr/bin is 60% Python wrappers"
rpm -q fedora-release | grep -q 38 && echo " - Still on F38? Even Red Hat gave up on you"
fi
# Extra
echo "🔍 RUNNING APP SCAN:"
if pidof discord >/dev/null; then
discord_ram=$(ps -o rss= -p $(pidof discord) | awk '{print $1/1024}')
echo " - 💀 DISCORD: ${discord_ram%.*}MB RAM but now you can blame Activision Blizzard (use Revolt/Matrix)"
fi
if pgrep -x "spotify" >/dev/null; then
echo " - 💀 SPOTIFY: Your music player phones home more than a CIA operative"
echo " >> Try 'spotifyd' + 'ncspot' for actual Linux vibes"
fi
if pgrep -x "steam" >/dev/null; then
echo " - 💀 STEAM: Your gaming rig runs 3 copies of glibc (2012 edition)"
fi
# Final inspection
detect_de
# ===== Bloat Calculations =====
non_gnu=$((conscious - gnu))
[ "$conscious" -ne 0 ] || conscious=1
gnu_ratio=$((gnu * 100 / conscious))
total_bloat=$((gnu_ratio + flatpak_bloat + snap_bloat + (distrobox_bloat * 10)))
# ===== Bloat Report =====
echo "💣 THERMONUCLEAR BLOAT REPORT:"
echo "-------------------------------"
echo "Traditional Packages:"
echo " Total : $total"
echo " Conscious choices : $conscious"
echo " GNU ratio : ${gnu_ratio}%"
echo " Containerized Crimes:"
echo " Flatpaks : ${flatpak_bloat}"
echo " Snaps : ${snap_bloat}"
echo " Distrobox : ${distrobox_bloat} containers"
echo "-------------------------------"
echo "TOTAL BLOAT SCORE : ${total_bloat}/300"
# ===== Final Verdict =====
if [ $total_bloat -lt 50 ]; then
echo "Status: Alpine Linux would be proud 🏔️"
elif [ $total_bloat -lt 90 ]; then
echo "Status: Mild bloat (Debian netinstall tier) 🐖"
elif [ $total_bloat -lt 130 ]; then
echo "Status: Obese (Ubuntu desktop territory) 🐘"
else
echo "Status: GNOME-DE level catastrophe ☢️"
[ "$init_system" = "systemd" ] && echo " >> Your journalctl is a novel about failed starts"
[ $flatpak_bloat -gt 0 ] && echo " >> Flatpaks detected: Your ~/.var is a filesystem tumor"
fi