Add Arch Linux support; Various tweaks

This commit is contained in:
2025-08-05 19:41:13 +01:00
parent 1df7b20fc5
commit 549aa12b46
17 changed files with 215 additions and 661 deletions

View File

@@ -1,7 +1,7 @@
# Trude's Dotfiles # Trude's Dotfiles
<p align="center"> <p align="center">
<img src="images/dotfiles-logo.png" alt="Logo Circle" width="200" align="middle"> <img src="images/logo-circle.png" alt="Logo Circle" width="200" align="middle">
</p> </p>

View File

@@ -113,7 +113,7 @@ remember-passwords=false
[org/gnome/shell/extensions/vitals] [org/gnome/shell/extensions/vitals]
fixed-widths=false fixed-widths=false
hot-sensors=['_memory_usage_', '_processor_usage_', '__temperature_max__'] hot-sensors=['_processor_usage_', '_gpu#1_usage_', '_memory_usage_', '__temperature_max__']
icon-style=1 icon-style=1
menu-centered=false menu-centered=false
position-in-panel=0 position-in-panel=0

View File

@@ -30,6 +30,13 @@ fi
set completion-ignore-case On set completion-ignore-case On
export OFLAGS="--ozone-platform-hint=auto" # Enable programmable completion features (loads all available completions)
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
export PATH=$PATH:$HOME/.local/bin export PATH=$PATH:$HOME/.local/bin

View File

@@ -0,0 +1 @@
#

0
home/Templates/text.txt Normal file
View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -8,14 +8,59 @@ CYAN="\e[36m"
BOLD="\e[1m" BOLD="\e[1m"
NC="\e[0m" NC="\e[0m"
install_package() {
if command -v pacman >/dev/null 2>&1; then
sudo pacman -Sy $@
elif command -v apt >/dev/null 2>&1; then
sudo apt install -y $@
fi
}
install_gnome_extension() {
uuid="$1"
if [ -z "$uuid" ]; then
printf "%b\n" "${RED}Usage: install_gnome_extension <extension-uuid>${NC}"
return 1
fi
if ! gnome-extensions list | grep -qw "$uuid"; then
printf "%b\n" "${YELLOW}[+]${NC} Sent install request for $uuid."
gdbus call --session --dest org.gnome.Shell.Extensions \
--object-path /org/gnome/Shell/Extensions \
--method org.gnome.Shell.Extensions.InstallRemoteExtension \
"$uuid" >/dev/null 2>&1
return 0
elif gnome-extensions list --updates | grep -qw "$uuid"; then
printf "%b\n" "${YELLOW}[+]${NC} Sent update request for $uuid."
gdbus call --session --dest org.gnome.Shell.Extensions \
--object-path /org/gnome/Shell/Extensions \
--method org.gnome.Shell.Extensions.InstallRemoteExtension \
"$uuid" >/dev/null 2>&1
return 0
else
printf "%b\n" "${GREEN}[✓]${NC} GNOME Extension $uuid is already installed."
return 0
fi
}
trap 'printf "${RED}install.sh interrupted.${NC}"; exit 1' INT TERM trap 'printf "${RED}install.sh interrupted.${NC}"; exit 1' INT TERM
if ! command -v whiptail >/dev/null 2>&1; then if ! command -v whiptail >/dev/null 2>&1; then
echo "${YELLOW}Installing whiptail...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Installing whiptail..."
sudo apt install -y whiptail install_package whiptail
fi fi
testing_branch="trixie" case "$XDG_CURRENT_DESKTOP" in
*GNOME*)
printf "%b\n" "${GREEN}[✓]${NC} Running on GNOME."
;;
*)
whiptail --title "Warning" --msgbox \
"Dconf settings and GNOME extensions can only be installed from within GNOME.\n\nPlease run this script again from within a GNOME session. The script will configure NetworkManager for you if needed." \
15 60
;;
esac
window_height='15' window_height='15'
window_width='60' window_width='60'
@@ -23,10 +68,12 @@ window_width='60'
W_MAIN=$( W_MAIN=$(
whiptail --notags --title "Trude's Dotfiles" \ whiptail --notags --title "Trude's Dotfiles" \
--cancel-button "Exit" \ --cancel-button "Exit" \
--menu "Main Menu" $window_height $window_width 3 \ --menu "Main Menu" $window_height $window_width 5 \
"install" "Install Dotfiles" \ "install" "Install Dotfiles" \
"reload" "Reload Configuration" \ "reload" "Reload Configuration" \
"update" "Update Debian" \ "paru" "Install Paru AUR Helper" \
"flatpak" "Install Flatpak" \
"update" "Update Distro" \
3>&1 1>&2 2>&3 3>&1 1>&2 2>&3
) )
@@ -39,215 +86,144 @@ if [ $W_MAIN = "update" ]; then
exit 0 exit 0
fi fi
if [ $W_MAIN = "install" ]; then
W_DEB_SOURCES=$(whiptail --notags --title "Debian Sources" \
--cancel-button "Skip" \
--menu "Choose your Debian source:" $window_height $window_width 2 \
"stable" "Stable" \
"testing" "Testing ($testing_branch)" \
3>&1 1>&2 2>&3)
fi
install_gnome_extension() {
uuid="$1"
if [ -z "$uuid" ]; then
echo "${RED}Usage: install_gnome_extension <extension-uuid>${NC}"
return 1
fi
if ! gnome-extensions list | grep -qw "$uuid"; then
echo "${GREEN}Sent install request for $uuid.${NC}"
gdbus call --session --dest org.gnome.Shell.Extensions \
--object-path /org/gnome/Shell/Extensions \
--method org.gnome.Shell.Extensions.InstallRemoteExtension \
"$uuid" >/dev/null 2>&1
return 0
elif gnome-extensions list --updates | grep -qw "$uuid"; then
echo "${GREEN}Sent update request for $uuid.${NC}"
gdbus call --session --dest org.gnome.Shell.Extensions \
--object-path /org/gnome/Shell/Extensions \
--method org.gnome.Shell.Extensions.InstallRemoteExtension \
"$uuid" >/dev/null 2>&1
return 0
else
echo "${GREEN}GNOME Extension $uuid is already installed.${NC}"
return 0
fi
}
# Clone Dotfiles if not already present # Clone Dotfiles if not already present
cd "$HOME/dotfiles" cd "$HOME/dotfiles"
if [ "$(pwd)" != "$HOME/dotfiles" ]; then if [ "$(pwd)" != "$HOME/dotfiles" ]; then
echo "${YELLOW}Cloning dotfiles repository...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Cloning dotfiles repository..."
sudo apt update install_package git
sudo apt install -y git
if ! git clone https://git.trude.dev/trude/dotfiles --depth 1; then if ! git clone https://git.trude.dev/trude/dotfiles --depth 1; then
echo "${RED}Error cloning dotfiles repository. Update skipped...${NC}" printf "%b\n" "${RED}Error cloning dotfiles repository. Update skipped...${NC}"
fi fi
cd dotfiles || exit cd dotfiles || exit
echo "${GREEN}dotfiles repository cloned successfully.${NC}" printf "%b\n" "${GREEN}[✓]${NC} Dotfiles repository cloned successfully."
# else else
# echo "${YELLOW}Updating dotfiles repository...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Updating dotfiles repository..."
# pull_output=$(git pull) pull_output=$(git pull)
# echo "$pull_output" echo "$pull_output"
# if ! echo "$pull_output" | grep -q "Already up to date."; then if ! echo "$pull_output" | grep -q "Already up to date."; then
# echo "${YELLOW}Changes detected. Re-running script...${NC}" printf "%b\n" "${YELLOW}Changes detected. Please re-run the script. Ignore this warning if you don't have an internet connection.${NC}"
# exec "$0" "$@" fi
# fi
fi fi
mkdir -p "$HOME/dotfiles/logs" mkdir -p "$HOME/dotfiles/logs"
if [ $W_MAIN = "flatpak" ]; then
install_package flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
if [ $W_MAIN = "paru" ]; then
sudo pacman -S --needed base-devel
git clone https://aur.archlinux.org/paru.git --depth=1
cd paru
makepkg -si
cd ..
rm -rf paru
fi
if [ $W_MAIN = "install" ]; then if [ $W_MAIN = "install" ]; then
echo "${YELLOW}Setting Debian Sources...${NC}"
case $W_DEB_SOURCES in
"stable")
echo "${CYAN}Using Stable sources.${NC}"
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bckp
sudo sh -c 'cat > /etc/apt/sources.list <<EOF
deb http://deb.debian.org/debian stable main contrib non-free
deb-src http://deb.debian.org/debian stable main contrib non-free
deb http://security.debian.org/debian-security stable-security main contrib non-free
deb-src http://security.debian.org/debian-security stable-security main contrib non-free
deb http://deb.debian.org/debian stable-updates main contrib non-free
deb-src http://deb.debian.org/debian stable-updates main contrib non-free
EOF'
break
;;
"testing")
echo "${CYAN}Using Testing sources.${NC}"
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bckp
sudo sh -c "cat > /etc/apt/sources.list <<EOF
deb http://deb.debian.org/debian $testing_branch main contrib non-free
deb-src http://deb.debian.org/debian $testing_branch main contrib non-free
deb http://security.debian.org/debian-security $testing_branch-security main contrib non-free
deb-src http://security.debian.org/debian-security $testing_branch-security main contrib non-free
deb http://deb.debian.org/debian $testing_branch-updates main contrib non-free
deb-src http://deb.debian.org/debian $testing_branch-updates main contrib non-free
EOF"
break
;;
*)
echo "${CYAN}Skipped.${NC}"
break
;;
esac
./scripts/update ./scripts/update
echo "${YELLOW}Installing Dependencies...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Installing Dependencies..."
sudo apt install git tmux fzf tealdeer pass-otp zbar-tools bat ufw unp network-manager flatpak \ install_package git tmux fzf tealdeer pass-otp zbar-tools bat ufw unp network-manager bash-completion
gir1.2-gtop-2.0 lm-sensors # Vitals Extension deps
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
echo "${YELLOW}Installing GNOME...${NC}"
sudo apt install gnome-core gnome-software-plugin-flatpak
# Remove Firefox (Epiphany installed instead)
echo "${YELLOW}Removing Firefox...${NC}"
sudo apt purge firefox-esr
# Enable Network Manager # Enable Network Manager
echo "${YELLOW}Enabling Network Manager...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Enabling Network Manager..."
sudo mv /etc/network/interfaces /etc/network/interfaces.bckp sudo mv /etc/network/interfaces /etc/network/interfaces.bckp
sudo systemctl restart networking sudo systemctl restart networking
sudo service NetworkManager restart sudo service NetworkManager restart
fi fi
# Copy files if [ "$W_MAIN" = "install" ] || [ "$W_MAIN" = "reload" ]; then
echo "${YELLOW}Installing Dotfiles...${NC}" # Copy files
cp -r "$HOME/dotfiles/home/." "$HOME" printf "%b\n" "${YELLOW}[+]${NC} Installing Dotfiles..."
cp -r "$HOME/dotfiles/home/." "$HOME"
# Copy wallpapers # Copy wallpapers
echo "${YELLOW}Installing Wallpapers...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Installing Wallpapers..."
sudo cp -r $HOME/dotfiles/wallpapers/* /usr/share/backgrounds/gnome/ sudo cp -r $HOME/dotfiles/wallpapers/* /usr/share/backgrounds/gnome/
# Copy scripts # Copy scripts
echo "${YELLOW}Installing Scripts...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Installing Scripts..."
mkdir -p "$HOME/.local/bin" mkdir -p "$HOME/.local/bin"
cp -r "$HOME/dotfiles/scripts/." "$HOME/.local/bin/" cp -r "$HOME/dotfiles/scripts/." "$HOME/.local/bin/"
# Install fonts # Install fonts
echo "${YELLOW}Installing fonts...${NC}" printf "%b\n" "${YELLOW}[+]${NC} Installing fonts..."
mkdir -p "$HOME/.local/share/fonts" mkdir -p "$HOME/.local/share/fonts"
cp -rf "$HOME/dotfiles/fonts/"* "$HOME/.local/share/fonts/" cp -rf "$HOME/dotfiles/fonts/"* "$HOME/.local/share/fonts/"
if [ ! -f "$HOME/dotfiles/logs/font_install.log" ]; then if [ ! -f "$HOME/dotfiles/logs/font_install.log" ]; then
fc-cache -fv "$HOME/.local/share/fonts" >"$HOME/dotfiles/logs/font_install.log" fc-cache -fv "$HOME/.local/share/fonts" >"$HOME/dotfiles/logs/font_install.log"
fi
# UFW Firewall
if [ "$reload" = false ]; then
echo "${YELLOW}Setting up UFW...${NC}"
sudo ufw default deny incoming
sudo ufw default allow outgoing
if systemctl is-active --quiet sshd; then
echo "${YELLOW}SSH Server detected; Enabling SSH rule...${NC}"
sudo ufw limit 22/tcp
fi fi
sudo ufw enable
sudo ss -tupln | tee "$HOME/dotfiles/logs/open_ports.log"
sudo ufw status numbered | tee "$HOME/dotfiles/logs/ufw_status.log"
fi
# Trude-only settings # UFW Firewall
if [ "$USER" = "trude" ]; then if [ "$reload" = false ]; then
# Git config printf "%b\n" "${YELLOW}[+]${NC} Setting up UFW..."
git config --global commit.gpgsign true sudo ufw default deny incoming
git config --global tag.gpgSign true sudo ufw default allow outgoing
git config --global gpg.format ssh if systemctl is-active --quiet sshd; then
git config --global user.signingkey ~/.ssh/id_ed25519.pub printf "%b\n" "${YELLOW}[+]${NC} SSH Server detected; Enabling SSH rule..."
git config --global user.name "TrudeEH" sudo ufw limit 22/tcp
git config --global user.email "ehtrude@gmail.com" fi
sudo ufw enable
sudo ss -tupln | tee "$HOME/dotfiles/logs/open_ports.log"
sudo ufw status numbered | tee "$HOME/dotfiles/logs/ufw_status.log"
fi
# Clone password-store # Trude-only settings
if [ ! -f "$HOME/.ssh/id_ed25519" ] || [ ! -f "$HOME/.ssh/id_ed25519.pub" ]; then if [ "$USER" = "trude" ]; then
echo "${RED}ED25519 key not found in ${CYAN}$HOME/.ssh/id_ed25519. ${RED}Please add your ED25519 key pair for password-store.${NC}" # Git config
elif ! gpg --list-keys "ehtrude@gmail.com" >/dev/null 2>&1; then git config --global commit.gpgsign true
echo "${RED}GPG key for ehtrude@gmail.com not found. Please import the key for password-store.${NC}" git config --global tag.gpgSign true
else git config --global gpg.format ssh
if [ ! -d "$HOME/.password-store" ]; then git config --global user.signingkey ~/.ssh/id_ed25519.pub
echo "${YELLOW}Cloning password-store...${NC}" git config --global user.name "TrudeEH"
chmod 700 ~/.ssh git config --global user.email "ehtrude@gmail.com"
chmod 600 ~/.ssh/*
if ! git clone git@git.trude.dev:trude/password-store.git "$HOME/.password-store"; then # Clone password-store
echo "${RED}Error cloning password-store.${NC}" if [ ! -f "$HOME/.ssh/id_ed25519" ] || [ ! -f "$HOME/.ssh/id_ed25519.pub" ]; then
else printf "%b\n" "${RED}ED25519 key not found in ${CYAN}$HOME/.ssh/id_ed25519. ${RED}Please add your ED25519 key pair for password-store.${NC}"
echo "${GREEN}Password-store cloned successfully.${NC}" elif ! gpg --list-keys "ehtrude@gmail.com" >/dev/null 2>&1; then
fi printf "%b\n" "${RED}GPG key for ehtrude@gmail.com not found. Please import the key for password-store.${NC}"
else else
echo "${CYAN}Password-store already present.${NC}" if [ ! -d "$HOME/.password-store" ]; then
printf "%b\n" "${YELLOW}[+]${NC} Cloning password-store..."
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
if ! git clone git@git.trude.dev:trude/password-store.git "$HOME/.password-store"; then
printf "%b\n" "${RED}Error cloning password-store.${NC}"
else
printf "%b\n" "${GREEN}[✓]${NC} Password-store cloned successfully."
fi
else
printf "%b\n" "${GREEN}[✓]${NC} Password-store already present."
fi
fi fi
fi fi
# Set up GNOME Desktop
case "$XDG_CURRENT_DESKTOP" in
*GNOME*)
printf "%b\n" "${YELLOW}[+]${NC} Installing GNOME Extensions..."
install_gnome_extension "caffeine@patapon.info"
install_gnome_extension "Vitals@CoreCoding.com"
install_gnome_extension "appindicatorsupport@rgcjonas.gmail.com"
install_gnome_extension "gsconnect@andyholmes.github.io"
printf "%b\n" "${YELLOW}[+]${NC} Loading Dconf settings..."
if ! dconf load / <"$HOME/dotfiles/dconf-settings.ini"; then
printf "%b\n" "${RED}Error loading Dconf settings.${NC}"
fi
;;
*)
printf "\n\n"
printf "%b\n" "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${NC}"
printf "\n"
printf "%b\n" "${CYAN}Dconf settings and GNOME extensions can only be installed after restarting."
printf "%b\n" "${CYAN}Please run the script again from within GNOME (with the reload option).${NC}"
printf "\n"
printf "%b\n" "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${NC}"
printf "\n"
;;
esac
fi fi
# Set up GNOME Desktop
case "$XDG_CURRENT_DESKTOP" in
*GNOME*)
echo "${YELLOW}Installing GNOME Extensions...${NC}"
install_gnome_extension "caffeine@patapon.info"
install_gnome_extension "Vitals@CoreCoding.com"
install_gnome_extension "appindicatorsupport@rgcjonas.gmail.com"
install_gnome_extension "gsconnect@andyholmes.github.io"
echo "${YELLOW}Loading Dconf settings...${NC}"
if ! dconf load / <"$HOME/dotfiles/dconf-settings.ini"; then
echo "${RED}Error loading Dconf settings.${NC}"
fi
;;
*)
echo
echo
echo "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${NC}"
echo
echo "${CYAN}Dconf settings and GNOME extensions can only be installed after restarting."
echo "${CYAN}Please run the script again from within GNOME (with the reload option).${NC}"
echo
echo "${RED}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!${NC}"
echo
;;
esac

View File

@@ -1,33 +0,0 @@
#! /bin/sh
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
MAGENTA="\e[35m"
CYAN="\e[36m"
BOLD="\e[1m"
NC="\e[0m"
BATTERY_INFO=$(upower -i "$(upower -e | grep 'BAT')")
BATTERY_PERCENT=$(echo "$BATTERY_INFO" | grep -oP 'percentage:\s+\K\d+')
BATTERY_STATUS=$(echo "$BATTERY_INFO" | grep -oP 'state:\s+\K\w+')
CHARGE_CYCLES=$(echo "$BATTERY_INFO" | grep -oP 'cycle-count:\s+\K\d+')
WARNING_LEVEL=$(echo "$BATTERY_INFO" | grep -oP 'warning-level:\s+\K\w+')
if [ "$BATTERY_STATUS" = "charging" ] || [ "$BATTERY_STATUS" = "pending" ]; then
COLOR=$CYAN
elif [ "$BATTERY_PERCENT" -ge 80 ]; then
COLOR=$GREEN
elif [ "$BATTERY_PERCENT" -ge 30 ]; then
COLOR=$YELLOW
else
COLOR=$RED
fi
echo "${BOLD}Battery: ${COLOR}$BATTERY_PERCENT% ($BATTERY_STATUS)${NC}"
if [ -n "$CHARGE_CYCLES" ]; then
echo "${BOLD}Charge Cycles: ${MAGENTA}$CHARGE_CYCLES${NC}"
fi
if [ "$WARNING_LEVEL" != "none" ]; then
echo "${BOLD}Warning Level: ${RED}$WARNING_LEVEL${NC}"
fi

View File

@@ -1,40 +0,0 @@
#! /bin/sh
YELLOW="\e[33m"
NC="\e[0m"
echo "\n${YELLOW}Downloading APT dependencies...${NC}\n"
sudo apt install build-essential git -y
sudo apt build-dep linux -y
echo "\n${YELLOW}Downloading kernel source...${NC}\n"
mkdir linux-parent && cd linux-parent || exit 1
git clone --depth 1 https://github.com/torvalds/linux
cd linux || exit 1
cp /boot/config-"$(uname -r)" .config # Copy current kernel config
make nconfig # Edit the current kernel configuration
diff /boot/config-"$(uname -r)" .config # Check your changes
# Do not include debugging symbols. Alternatively, use `strip` to remove them. (these configs are working as of 6.14)
scripts/config --undefine GDB_SCRIPTS
scripts/config --undefine DEBUG_INFO
scripts/config --undefine DEBUG_INFO_SPLIT
scripts/config --undefine DEBUG_INFO_REDUCED
scripts/config --undefine DEBUG_INFO_COMPRESSED
scripts/config --set-val DEBUG_INFO_NONE y
scripts/config --set-val DEBUG_INFO_DWARF5 n
scripts/config --disable DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
echo "\n${YELLOW}Compiling the kernel...${NC}\n"
make -j"$(nproc)" deb-pkg LOCALVERSION=-custom
echo "\n${YELLOW}Installing the generated dpkg packages...${NC}\n"
sudo dpkg -i ../linux-headers*-custom*.deb
sudo dpkg -i ../linux-image*-custom*.deb
echo "\n${YELLOW}Cleaning up...${NC}\n"
cd ../..
rm -rf linux-parent
dpkg --list | grep linux-image

View File

@@ -10,46 +10,46 @@ BOLD="\e[1m"
NC="\e[0m" NC="\e[0m"
# User and host info # User and host info
echo "${BOLD}${MAGENTA}${USER}@$(hostname)${NC}" printf "%b\n" "${BOLD}${MAGENTA}${USER}@$(hostname)${NC}"
echo "---------" printf "%b\n" "---------"
# OS and architecture # OS and architecture
OS=$(grep '^PRETTY_NAME=' /etc/os-release | cut -d= -f2 | tr -d '"') OS=$(grep '^PRETTY_NAME=' /etc/os-release | cut -d= -f2 | tr -d '"')
ARCH=$(uname -m) ARCH=$(uname -m)
echo "${CYAN}OS:${NC} $OS $ARCH" printf "%b\n" "${CYAN}OS:${NC} $OS $ARCH"
# Host Model # Host Model
HOST_MODEL=$(cat /sys/class/dmi/id/product_name 2>/dev/null) HOST_MODEL=$(cat /sys/class/dmi/id/product_name 2>/dev/null)
HOST_VERSION=$(cat /sys/class/dmi/id/product_version 2>/dev/null) HOST_VERSION=$(cat /sys/class/dmi/id/product_version 2>/dev/null)
echo "${CYAN}Host:${NC} ${HOST_VERSION} (${HOST_MODEL})" printf "%b\n" "${CYAN}Host:${NC} ${HOST_VERSION} (${HOST_MODEL})"
# Kernel version # Kernel version
echo "${CYAN}Kernel:${NC} Linux $(uname -r)" printf "%b\n" "${CYAN}Kernel:${NC} Linux $(uname -r)"
# Uptime # Uptime
UPTIME=$(uptime -p | sed 's/up //') UPTIME=$(uptime -p | sed 's/up //')
echo "${CYAN}Uptime:${NC} $UPTIME" printf "%b\n" "${CYAN}Uptime:${NC} $UPTIME"
# Package counts: dpkg and flatpak # Package counts: dpkg and flatpak
PKG_COUNT=$(dpkg-query -f '${binary:Package}\n' -W 2>/dev/null | wc -l) PKG_COUNT=$(dpkg-query -f '${binary:Package}\n' -W 2>/dev/null | wc -l)
FLAT_COUNT=$(flatpak list 2>/dev/null | wc -l) FLAT_COUNT=$(flatpak list 2>/dev/null | wc -l)
echo "${CYAN}Packages:${NC} ${PKG_COUNT} (dpkg), ${FLAT_COUNT} (flatpak)" printf "%b\n" "${CYAN}Packages:${NC} ${PKG_COUNT} (dpkg), ${FLAT_COUNT} (flatpak)"
# Shell and version # Shell and version
BASH_VER=$(bash --version | head -n1 | awk '{print $4}' | cut -d'(' -f1) BASH_VER=$(bash --version | head -n1 | awk '{print $4}' | cut -d'(' -f1)
echo "${CYAN}Shell:${NC} bash ${BASH_VER}" printf "%b\n" "${CYAN}Shell:${NC} bash ${BASH_VER}"
# Desktop Environment # Desktop Environment
DE=${XDG_CURRENT_DESKTOP:-"Unknown"} DE=${XDG_CURRENT_DESKTOP:-"Unknown"}
echo "${CYAN}DE:${NC} $DE" printf "%b\n" "${CYAN}DE:${NC} $DE"
# CPU model from /proc/cpuinfo # CPU model from /proc/cpuinfo
CPU=$(awk -F: '/model name/ {print $2; exit}' /proc/cpuinfo | sed 's/^[ \t]*//') CPU=$(awk -F: '/model name/ {print $2; exit}' /proc/cpuinfo | sed 's/^[ \t]*//')
echo "${CYAN}CPU:${NC} $CPU" printf "%b\n" "${CYAN}CPU:${NC} $CPU"
# GPU info # GPU info
GPU=$(lspci | grep -i 'vga\|3d' | head -n1 | cut -d: -f3 | sed 's/^[ \t]*//') GPU=$(lspci | grep -i 'vga\|3d' | head -n1 | cut -d: -f3 | sed 's/^[ \t]*//')
echo "${CYAN}GPU:${NC} $GPU" printf "%b\n" "${CYAN}GPU:${NC} $GPU"
# Memory usage # Memory usage
mem_info=$(free | awk '/Mem:/ {print $2, $3}') mem_info=$(free | awk '/Mem:/ {print $2, $3}')
@@ -68,7 +68,7 @@ fi
mem_total=$(free -h | awk '/Mem:/ {print $2}') mem_total=$(free -h | awk '/Mem:/ {print $2}')
mem_used=$(free -h | awk '/Mem:/ {print $3}') mem_used=$(free -h | awk '/Mem:/ {print $3}')
echo "${CYAN}Memory:${NC} ${mem_used} / ${mem_total} (${percent_color}${percent}%${NC})" printf "%b\n" "${CYAN}Memory:${NC} ${mem_used} / ${mem_total} (${percent_color}${percent}%${NC})"
# Swap usage # Swap usage
swap_used=$(free -h | awk '/Swap/ {print $3}') swap_used=$(free -h | awk '/Swap/ {print $3}')
@@ -83,7 +83,7 @@ else
swap_perc_color=$RED swap_perc_color=$RED
fi fi
echo "${CYAN}Swap:${NC} ${swap_used} / ${swap_total} (${swap_perc_color}${swap_perc}%${NC})" printf "%b\n" "${CYAN}Swap:${NC} ${swap_used} / ${swap_total} (${swap_perc_color}${swap_perc}%${NC})"
# Root disk usage # Root disk usage
root_line=$(df -h / | awk 'NR==2') root_line=$(df -h / | awk 'NR==2')
@@ -97,7 +97,7 @@ elif [ "$root_percent" -le 80 ]; then
else else
root_color=$RED root_color=$RED
fi fi
echo "${CYAN}Disk (/):${NC} ${root_used} / ${root_total} (${root_color}${root_percent}%${NC})" printf "%b\n" "${CYAN}Disk (/):${NC} ${root_used} / ${root_total} (${root_color}${root_percent}%${NC})"
# /home disk usage # /home disk usage
home_line=$(df -h /home 2>/dev/null | awk 'NR==2') home_line=$(df -h /home 2>/dev/null | awk 'NR==2')
@@ -112,7 +112,7 @@ if [ -n "$home_line" ]; then
else else
home_color=$RED home_color=$RED
fi fi
echo "${CYAN}Disk (/home):${NC} ${home_used} / ${home_total} (${home_color}${home_percent}%${NC})" printf "%b\n" "${CYAN}Disk (/home):${NC} ${home_used} / ${home_total} (${home_color}${home_percent}%${NC})"
fi fi
# Determine the primary network interface used for internet access # Determine the primary network interface used for internet access
@@ -120,11 +120,11 @@ PRIMARY_IFACE=$(ip route get 8.8.8.8 2>/dev/null | awk '{print $5; exit}')
if [ -n "$PRIMARY_IFACE" ]; then if [ -n "$PRIMARY_IFACE" ]; then
LOCAL_IP=$(ip addr show "$PRIMARY_IFACE" | awk '/inet / {print $2}' | cut -d'/' -f1) LOCAL_IP=$(ip addr show "$PRIMARY_IFACE" | awk '/inet / {print $2}' | cut -d'/' -f1)
echo "${CYAN}Local IP ($PRIMARY_IFACE):${NC} ${LOCAL_IP}" printf "%b\n" "${CYAN}Local IP ($PRIMARY_IFACE):${NC} ${LOCAL_IP}"
else else
echo "${RED}Local IP:${NC} Unable to determine primary network interface." printf "%b\n" "${RED}Local IP:${NC} Unable to determine primary network interface."
fi fi
# Current locale setting # Current locale setting
LOCALE=$(locale | awk -F= '/^LANG=/{print $2; exit}') LOCALE=$(locale | awk -F= '/^LANG=/{print $2; exit}')
echo "${CYAN}Locale:${NC} $LOCALE" printf "%b\n" "${CYAN}Locale:${NC} $LOCALE"

View File

@@ -1,27 +0,0 @@
#!/bin/sh
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
NC="\e[0m"
mem_info=$(free | awk '/Mem:/ {print $2, $3}')
set -- $mem_info
total=$1
used=$2
percent=$(awk "BEGIN {printf \"%.0f\", ($used/$total)*100}")
mem_total=$(free -h | awk '/Mem:/ {print $2}')
mem_used=$(free -h | awk '/Mem:/ {print $3}')
if [ -t 1 ]; then
if [ "$percent" -le 60 ]; then
percent_color=$GREEN
elif [ "$percent" -le 80 ]; then
percent_color=$YELLOW
else
percent_color=$RED
fi
echo " ${mem_used} / ${mem_total} (${percent_color}${percent}%${NC})"
else
echo "${mem_used} ${mem_total} ${percent}"
fi

View File

@@ -1,75 +0,0 @@
#! /bin/sh
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
CYAN="\e[36m"
NC="\e[0m"
trap "echo '${CYAN}System Monitor interrupted.${NC}'; exit 1" INT TERM
echo
echo
echo
# Cache in tmpfs to improve speed and reduce SSD load
cache=/tmp/cpu-script-cache
rm /tmp/cpu-script-cache 2>/dev/null
while true; do
# CPU
cpu_stats=$(awk '/^cpu / {print $2 + $3 + $4 + $5, $5}' /proc/stat)
if [ ! -f "$cache" ]; then
echo "$cpu_stats" >"$cache"
cpu_color=$CYAN
usage="--"
else
prev_stats=$(cat "$cache")
total=$(echo "$prev_stats" | awk '{print $1}')
prev_idle=$(echo "$prev_stats" | awk '{print $2}')
curr_total=$(echo "$cpu_stats" | awk '{print $1}')
curr_idle=$(echo "$cpu_stats" | awk '{print $2}')
total_diff=$((curr_total - total))
idle_diff=$((curr_idle - prev_idle))
if [ "$total_diff" -eq 0 ]; then
usage=0 # Avoid division by zero
else
usage=$((100 * (total_diff - idle_diff) / total_diff))
fi
if [ "$usage" -lt 50 ]; then
cpu_color=$GREEN
elif [ "$usage" -lt 70 ]; then
cpu_color=$YELLOW
else
cpu_color=$RED
fi
fi
# MEMORY
mem_info=$(free | awk '/Mem:/ {print $2, $3}')
set -- $mem_info
total=$1
used=$2
percent=$(awk "BEGIN {printf \"%.0f\", ($used/$total)*100}")
mem_total=$(free -h | awk '/Mem:/ {print $2}')
mem_used=$(free -h | awk '/Mem:/ {print $3}')
if [ "$percent" -le 60 ]; then
mem_color=$GREEN
elif [ "$percent" -le 80 ]; then
mem_color=$YELLOW
else
mem_color=$RED
fi
printf "\033[4A"
echo "============================="
echo " ${cpu_color}${usage}%${NC} "
echo " ${mem_used} / ${mem_total} (${mem_color}${percent}%${NC}) "
echo "============================="
echo "$cpu_stats" >"$cache"
sleep 2
done

View File

@@ -1,13 +0,0 @@
#!/bin/sh
# Wifi
if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ]; then
wifiicon="$(awk '/^[[:space:]]*w/ { gsub(/[[:space:]]+/, " "); print " ", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ]; then
wifiicon=" "
fi
# Ethernet
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="󰛳 " || ethericon="󰅛 "
printf "%s%s\n" "$wifiicon" "$ethericon"

View File

@@ -1,215 +0,0 @@
#! /bin/bash
# Cross-distro package manager UI
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
BLUE="\e[34m"
MAGENTA="\e[35m"
CYAN="\e[36m"
GRAY="\e[90m"
BOLD="\e[1m"
FAINT="\e[2m"
ITALIC="\e[3m"
UNDERLINE="\e[4m"
NC="\e[0m"
pcheck() {
local pms=()
if command -v nix >/dev/null 2>&1; then
pms+=("nix")
fi
if command -v brew >/dev/null 2>&1; then
pms+=("brew")
fi
if command -v apt >/dev/null 2>&1; then
pms+=("apt")
elif command -v pacman >/dev/null 2>&1; then
if command -v paru >/dev/null 2>&1; then
pms+=("paru")
fi
pms+=("pacman")
elif command -v dnf >/dev/null 2>&1; then
pms+=("dnf")
fi
if command -v flatpak >/dev/null 2>&1; then
pms+=("flatpak")
fi
echo "${pms[@]}"
}
p() (
trap "echo -e '\n${RED}p interrupted.${NC}'; exit 1" SIGINT SIGTERM
packageManagers=($(pcheck))
updateP() {
if [[ ${packageManagers[@]} =~ "flatpak" ]]; then
printf "%b\n" "${YELLOW}Updating flatpak...${NC}"
flatpak update
flatpak uninstall --unused --delete-data
fi
if [[ ${packageManagers[@]} =~ "nix" ]]; then
printf "%b\n" "${YELLOW}Updating nix...${NC}"
nix-channel --update
nix-collect-garbage --delete-older-than 7d &>/dev/null
if command -v nixos-rebuild >/dev/null 2>&1; then
sudo nix-channel --update
printf "${YELLOW}Rebuilding NixOS...${NC}\n"
sudo nixos-rebuild switch &>/tmp/nixos_rebuild.log || (
cat /tmp/nixos_rebuild.log | grep --color error && false
)
fi
fi
if [[ ${packageManagers[@]} =~ "brew" ]]; then
printf "%b\n" "${YELLOW}Updating brew...${NC}"
brew update
brew doctor
brew upgrade
fi
if [[ ${packageManagers[@]} =~ "apt" ]]; then
printf "%b\n" "${YELLOW}Updating apt...${NC}"
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt autoremove
sudo apt autoclean
elif [[ ${packageManagers[@]} =~ "pacman" ]]; then
printf "%b\n" "${YELLOW}Updating pacman...${NC}"
sudo sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
if [[ ${packageManagers[@]} =~ "paru" ]]; then
paru -Syu
else
sudo pacman -Syu
fi
sudo pacman -Rsn $(pacman -Qdtq)
if [ ! "$(command -v reflector)" ]; then
printf "%b\n" "${YELLOW}Selecting fastest pacman mirrors...${NC}"
sudo pacman -Sy --noconfirm reflector rsync curl
iso=$(curl -4 ifconfig.co/country-iso)
extra="FR"
sudo reflector -a 48 -c $iso -c $extra -f 5 -l 30 --verbose --sort rate --save /etc/pacman.d/mirrorlist
fi
if [ ! "$(command -v paccache)" ]; then
sudo pacman -Sy --noconfirm pacman-contrib
fi
paccache -rk1
elif [[ ${packageManagers[@]} =~ "dnf" ]]; then
printf "%b\n" "${YELLOW}Updating dnf...${NC}"
sudo dnf upgrade --refresh
sudo dnf autoremove
fi
}
installP() {
for pm in "${packageManagers[@]}"; do
printf "%b\n" "${YELLOW}Attempting ${pm} install...${NC}"
case "$pm" in
flatpak)
flatpak install "$1"
;;
paru)
paru -Sy "$1"
;;
apt)
sudo apt install "$1"
;;
pacman)
sudo pacman -Sy "$1"
;;
dnf)
sudo dnf install "$1"
;;
brew)
brew install "$1"
;;
*)
continue
;;
esac
if [[ $? == 0 ]]; then
return 0
fi
done
printf "%b\n" "${RED}ERROR: $1 not found.${NC}"
return 1
}
removeP() {
for pm in "${packageManagers[@]}"; do
printf "%b\n" "${YELLOW}Attempting ${pm} uninstall...${NC}"
case "$pm" in
flatpak)
flatpak uninstall "$1"
;;
brew)
brew uninstall "$1"
;;
apt)
sudo apt remove "$1"
;;
pacman)
sudo pacman -Rs "$1"
;;
paru)
paru -Rns "$1"
;;
dnf)
sudo dnf remove "$1"
;;
*)
continue
;;
esac
if [[ $? == 0 ]]; then
return 0
fi
done
printf "%b\n" "${RED}ERROR: $1 not found.${NC}"
return 1
}
shellP() {
if [[ ${packageManagers[@]} =~ "nix" ]]; then
printf "%b\n" "${YELLOW}Attempting to create nix shell...${NC}"
nix-shell -p $1
if [[ $? == 0 ]]; then
return 0
fi
fi
}
# If no parameter or u
printf "%b\n" "${CYAN}Detected package managers: ${MAGENTA}${packageManagers[*]}${NC}"
if [ -z $1 ] || [ $1 = "u" ]; then
updateP
return 0
elif [ $1 = "i" ]; then # If first parameter is i (install)
shift
for package in "$@"; do
installP $package
done
elif [ $1 = "r" ]; then # If first parameter is r (remove)
shift
for package in "$@"; do
removeP $package
done
elif [ $1 = "c" ]; then # If first parameter is c (check)
shift
for package in "$@"; do
checkP $package
done
elif [ $1 = "s" ]; then # If first parameter is s (shell)
shift
shellP $@
else
printf "%b\n" "${YELLOW}${UNDERLINE}[i] Usage:${NC}"
printf "%b\n" "p (u) ${FAINT}- update os${NC}"
printf "%b\n" "p i package ${FAINT}- install package${NC}"
printf "%b\n" "p r package ${FAINT}- remove package${NC}"
printf "%b\n" "p s packages ${FAINT}- launch a nix shell with the specified packages${NC}"
printf "%b\n" "${FAINT}Supported package managers: flatpak, nix, brew, apt, paru, pacman, dnf${NC}"
return 1
fi
)

View File

@@ -1,5 +0,0 @@
#!/bin/bash
paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) |
column -s "$(printf '\t')" -t |
sed 's/\(.\)..$/.\1°C/'

View File

@@ -1,32 +1,38 @@
#! /bin/sh #! /bin/sh
YELLOW="\e[33m" YELLOW="\e[33m"
GRAY="\e[90m"
NC="\e[0m" NC="\e[0m"
printf "%b\n" "${YELLOW}[+]${NC} Updating repos..." if command -v paru >/dev/null 2>&1; then
printf "%b" "${GRAY}" printf "%b\n" "${YELLOW}[+]${NC} Updating Arch using paru..."
sudo apt-get update paru
printf "%b" "${NC}" printf "%b\n" "${YELLOW}[+]${NC} Removing orphaned dependencies..."
sudo pacman -Rsn $(pacman -Qdtq)
elif command -v pacman >/dev/null 2>&1; then
printf "%b\n" "${YELLOW}[+]${NC} Updating Arch..."
sudo pacman -Syu
printf "%b\n" "${YELLOW}[+]${NC} Removing orphaned dependencies..."
sudo pacman -Rsn $(pacman -Qdtq)
elif command -v apt >/dev/null 2>&1; then
printf "%b\n" "${YELLOW}[+]${NC} Updating repos..."
sudo apt-get update
printf "%b" "${NC}"
printf "%b\n" "${YELLOW}[+]${NC} Upgrading packages..." printf "%b\n" "${YELLOW}[+]${NC} Upgrading packages..."
printf "%b" "${GRAY}" sudo apt-get full-upgrade
sudo apt-get full-upgrade printf "%b" "${NC}"
printf "%b" "${NC}"
printf "%b\n" "${YELLOW}[+]${NC} Removing orphaned dependencies..." printf "%b\n" "${YELLOW}[+]${NC} Removing orphaned dependencies..."
printf "%b" "${GRAY}" sudo apt-get autoremove
sudo apt-get autoremove printf "%b" "${NC}"
printf "%b" "${NC}"
printf "%b\n" "${YELLOW}[+]${NC} Cleaning up..." printf "%b\n" "${YELLOW}[+]${NC} Cleaning up..."
printf "%b" "${GRAY}" sudo apt-get autoclean
sudo apt-get autoclean printf "%b" "${NC}"
printf "%b" "${NC}" fi
if command -v flatpak >/dev/null 2>&1; then if command -v flatpak >/dev/null 2>&1; then
printf "%b\n" "${YELLOW}[+]${NC} Updating flatpak packages..." printf "%b\n" "${YELLOW}[+]${NC} Updating flatpak packages..."
printf "%b" "${GRAY}"
flatpak update flatpak update
flatpak uninstall --unused --delete-data flatpak uninstall --unused --delete-data
printf "%b" "${NC}" printf "%b" "${NC}"

View File

@@ -1,28 +0,0 @@
#!/bin/sh
# Prints the current volume or  if muted.
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
# If muted, print  and exit.
[ "$vol" != "${vol%\[MUTED\]}" ] && echo " " && exit
vol="${vol#Volume: }"
split() {
# For ommiting the . without calling and external program.
IFS=$2
set -- $1
printf '%s' "$@"
}
vol="$(printf "%.0f" "$(split "$vol" ".")")"
case $1 in
$((vol >= 70))) icon=" " ;;
$((vol >= 30))) icon=" " ;;
$((vol >= 1))) icon=" " ;;
*) echo " " && exit ;;
esac
echo "$icon$vol%"