Fix hyprland, monitor management and waybar after lua switch

This commit is contained in:
2026-08-29 00:55:17 +02:00
parent 9db0b4dac0
commit be4de88d1a
45 changed files with 593 additions and 388 deletions

View File

@@ -1,78 +0,0 @@
#!/bin/bash
BAT_PATH="/sys/class/power_supply/BAT0"
if [ ! -d "$BAT_PATH" ]; then
echo "Batterie non trouvée"
exit 1
fi
# Lire les informations
capacity=$(cat "$BAT_PATH/capacity" 2>/dev/null)
status=$(cat "$BAT_PATH/status" 2>/dev/null)
charge_now=$(cat "$BAT_PATH/charge_now" 2>/dev/null) # µAh
current_now=$(cat "$BAT_PATH/current_now" 2>/dev/null) # µA
voltage_now=$(cat "$BAT_PATH/voltage_now" 2>/dev/null) # µV
max_limit=$(cat "$BAT_PATH/charge_control_end_threshold" 2>/dev/null)
# Valeurs par défaut
[ -z "$capacity" ] && capacity=0
[ -z "$status" ] && status="Unknown"
[ -z "$max_limit" ] && max_limit=100
# Calcul de la puissance (si voltage et courant disponibles)
# if [ -n "$voltage_now" ] && [ -n "$current_now" ] && [ "$current_now" -gt 0 ]; then
# wattage=$(echo "scale=1; $voltage_now * $current_now / 1000000000000" | bc)
# else
# wattage=""
# fi
wattage=$(cat /tmp/power_now 2>/dev/null)
# Calcul du temps restant (en minutes) si en décharge
time_str=""
if [ "$status" = "Discharging" ] && [ -n "$charge_now" ] && [ -n "$current_now" ] && [ "$current_now" -gt 0 ]; then
time_h=$(echo "scale=2; $charge_now / $current_now" | bc)
time_min=$(echo "$time_h * 60" | bc | cut -d. -f1)
if [ -n "$time_min" ] && [ "$time_min" -gt 0 ]; then
hours=$(( time_min / 60 ))
minutes=$(( time_min % 60 ))
time_str=$(printf "%d:%02d" $hours $minutes)
fi
fi
# Affichage selon l'état
if [ "$status" = "Charging" ]; then
icon="⚡"
if [ -n "$wattage" ]; then
text="${icon} ${capacity}% (${wattage}W - ${max_limit}%)"
else
text="${icon} ${capacity}% (${max_limit}%)"
fi
elif [ "$status" = "Discharging" ]; then
# Icône batterie selon le niveau
if [ $capacity -le 20 ]; then
icon=""
elif [ $capacity -le 40 ]; then
icon=""
elif [ $capacity -le 60 ]; then
icon=""
elif [ $capacity -le 80 ]; then
icon=""
else
icon=""
fi
if [ -n "$time_str" ] && [ -n "$wattage" ]; then
text="${icon} ${capacity}% (${time_str} - ${wattage}W - ${max_limit}%)"
else
text="${icon} ${capacity}% (${max_limit}%)"
fi
else
icon=""
if [ -n "$wattage" ]; then
text="${icon} ${capacity}% (${wattage}W - ${max_limit}%)"
else
text="${icon} ${capacity}% (${max_limit}%)"
fi
fi
echo "$text"

View File

@@ -1,9 +0,0 @@
#!/bin/bash
current=$(cat /sys/class/power_supply/BAT0/charge_control_end_threshold)
if [ "$current" -eq 80 ]; then
sudo cctk --PrimaryBattChargeCfg=Custom:95-100
notify-send "Batterie" "Charge standard (100%)"
else
sudo cctk --PrimaryBattChargeCfg=Custom:50-80
notify-send "Batterie" "Charge limitée à 80%"
fi

View File

@@ -1,2 +0,0 @@
#!/bin/bash
alacritty -e hyprdynamicmonitors tui

View File

@@ -1,6 +0,0 @@
#!/bin/bash
if grep -q "eco_mode=1" /proc/cmdline; then
ln -sf "$HOME/.config/hyprdynamicmonitors/config-eco.toml" "$HOME/.config/hyprdynamicmonitors/config.toml"
else
ln -sf "$HOME/.config/hyprdynamicmonitors/config-power.toml" "$HOME/.config/hyprdynamicmonitors/config.toml"
fi

View File

@@ -1,6 +0,0 @@
#!/bin/bash
if [ -f /run/eco_mode ]; then
exec hypridle -c ~/.config/hypr/hypridle-eco.conf
else
exec hypridle -c ~/.config/hypr/hypridle.conf
fi

View File

@@ -1,9 +0,0 @@
#!/bin/bash
RAPL0="/sys/class/powercap/intel-rapl:0/energy_uj"
RAPL1="/sys/class/powercap/intel-rapl:1/energy_uj"
while true; do
e1=$(( $(cat "$RAPL0") + $(cat "$RAPL1") ))
sleep 2
e2=$(( $(cat "$RAPL0") + $(cat "$RAPL1") ))
echo "scale=1; ($e2 - $e1) / 2000000" | bc > /tmp/power_now
done

View File

@@ -7,14 +7,11 @@ sudo rm -f /var/cache/pacman/pkg/download-* 2>/dev/null || true
echo "==> Nettoyage cache pacman..."
sudo paccache -r -k1 -q 2>/dev/null || true
echo "==> Nettoyage orphelins yay..."
yay -Yc --noconfirm 2>/dev/null || true
echo "==> Rotation journaux systemd..."
sudo journalctl --vacuum-time=2weeks 2>/dev/null || true
echo "==> Suppression paquets orphelins..."
orphans=$(pacman -Qdtq 2>/dev/null) || true
orphans=$(pacman -Qdtq 2>/dev/null) || true
if [ -n "$orphans" ]; then
sudo pacman -Rns $orphans --noconfirm || true
else
@@ -22,8 +19,11 @@ else
fi
echo "==> Nettoyage cache utilisateur..."
find ~/.cache -type f -delete 2>/dev/null || true
find ~/.cache -type d -empty -delete 2>/dev/null || true
# Artefacts de build AUR (préserve les dépôts git)
rm -rf ~/.cache/yay/*/src ~/.cache/yay/*/pkg ~/.cache/yay/*/*.pkg.tar.zst 2>/dev/null || true
# Miniatures non modifiées depuis 30 jours
find ~/.cache/thumbnails -type f -mtime +30 -delete 2>/dev/null || true
find ~/.cache/thumbnails -type d -empty -delete 2>/dev/null || true
echo "==> Nettoyage npm..."
npm cache clean --force 2>/dev/null || true
@@ -32,4 +32,4 @@ echo "==> Nettoyage historiques..."
> ~/.lesshst
> ~/.wget-hsts
echo "==> Terminé."
echo "==> Terminé."

View File

@@ -0,0 +1,46 @@
adwaita-qt5-git
adwaita-qt6-git
android-studio
appimagelauncher
balena-etcher
beeper-v4-bin
bibata-cursor-theme-bin
catppuccin-gtk-theme-mocha
chirp-next
chromium-widevine
cnrdrvcups-lb-bin
collabora-office
dell-command-configure
dupeguru
electron37
gimp-plugin-resynthesizer
glava
google-chrome
grimblast-git
gtk2
hyprdynamicmonitors-bin
kdeconnect-git
libjpeg6-turbo
log2ram
networkmanager-dmenu-git
obs-advanced-masks
obs-move-transition
onlyoffice-bin
openssl-1.1
orca-slicer-bin
python-yattag
refind-theme-catppuccin-git
rsgain
rtpmidid-bin
rustdesk-bin
sddm-theme-catppuccin-git
spotify
ungoogled-chromium-bin
ventoy-bin
vesktop-bin
vibe-audio-visualizer-git
vscodium-bin
wlogout
xwaylandvideobridge
yay
zsh-theme-powerlevel10k-git

View File

@@ -0,0 +1,210 @@
adwaita-qt5-git
adwaita-qt6-git
aegisub
alacritty
alsa-firmware
alsa-utils
android-studio
android-tools
android-udev
appimagelauncher
audacity
balena-etcher
base
base-devel
bc
beeper-v4-bin
bibata-cursor-theme-bin
blender
blueman
bluez
bluez-utils
bolt
brightnessctl
btop
catppuccin-gtk-theme-mocha
cdrtools
chirp-next
chromium-widevine
cliphist
cnrdrvcups-lb-bin
collabora-office
converseen
cups
dell-command-configure
dex
dnsmasq
drawio-desktop
dupeguru
etckeeper
exfat-utils
eza
f3d
file-roller
firefox
firefox-i18n-fr
flatpak
fwupd
gamemode
ghostscript
gimp
gimp-plugin-gmic
gimp-plugin-resynthesizer
git
github-cli
glava
gnome-calculator
gnome-characters
gnome-keyring
godot
google-chrome
gptfdisk
grim
grimblast-git
gst-plugin-pipewire
gvfs
gvfs-afc
gvfs-mtp
gvfs-smb
handbrake
hyprdynamicmonitors-bin
hypridle
hyprland
hyprlock
inkscape
intel-gpu-tools
intel-media-driver
intel-ucode
iwd
jack2
jdk17-openjdk
jq
kasts
kdeconnect-git
kdenlive
kid3-qt
lib32-gamemode
lib32-nvidia-utils
libva-utils
libvirt
linux
linux-firmware
linux-headers
log2ram
mako
man-db
man-pages
mesa-utils
meson
mixxx
mpv
mtools
mumble
nano
ncdu
ncspot
network-manager-applet
networkmanager
networkmanager-dmenu-git
nextcloud-client
nm-connection-editor
nmap
noto-fonts-cjk
ntfs-3g
ntfsprogs
nvidia-open-dkms
nvidia-settings
nvidia-utils
nvtop
nwg-look
obs-advanced-masks
obs-move-transition
obs-studio
obsidian
onlyoffice-bin
openrct2
orca-slicer-bin
pacman-contrib
pamixer
papirus-icon-theme
pavucontrol
perl-image-exiftool
pinta
pipewire-alsa
pipewire-pulse
plymouth
polkit-kde-agent
power-profiles-daemon
powertop
projectm
python-build
python-installer
python-pipx
qemu-full
qt5-graphicaleffects
qt5-quickcontrols2
qt5-svg
qt5-wayland
qt6-5compat
qt6-wayland
refind
refind-theme-catppuccin-git
rofi
rsgain
rtpmidid-bin
rustdesk-bin
sane-airscan
sbctl
sddm
sddm-theme-catppuccin-git
seahorse
signal-desktop
slurp
sof-firmware
spotify
sqlcipher
steam
swaybg
syncthing
system-config-printer
tcpdump
texinfo
thermald
throttled
thunar
thunar-archive-plugin
thunderbird
timeshift
tree
ttf-jetbrains-mono-nerd
tumbler
ungoogled-chromium-bin
unzip
ventoy-bin
vesktop-bin
vibe-audio-visualizer-git
viewnior
virt-manager
vscodium-bin
vulkan-intel
waybar
websocat
wget
whois
wine
wine-gecko
wine-mono
wireguard-tools
wl-clipboard
wlogout
woff2-font-awesome
wol
xdg-desktop-portal-hyprland
xjadeo
xwaylandvideobridge
yay
ydotool
yt-dlp
zram-generator
zsh
zsh-theme-powerlevel10k-git

147
scripts/utilities/format.sh Executable file
View File

@@ -0,0 +1,147 @@
#!/usr/bin/env bash
#
# usb-format.sh — formate proprement une clé USB / carte SD
# Usage: usb-format.sh /dev/sdX [fat32|exfat|ext4] [LABEL]
set -euo pipefail
DEVICE="${1:-}"
FSTYPE="${2:-fat32}"
LABEL="${3:-}"
if [[ -z "$DEVICE" ]]; then
echo "Usage: $0 /dev/sdX [fat32|exfat|ext4] [LABEL]"
echo
echo "Périphériques disponibles :"
lsblk -d -o NAME,SIZE,MODEL,TRAN
exit 1
fi
# Normaliser le chemin (accepte "sdb" ou "/dev/sdb")
[[ "$DEVICE" != /dev/* ]] && DEVICE="/dev/$DEVICE"
# --- Garde-fous ---
if [[ ! -b "$DEVICE" ]]; then
echo "Erreur : $DEVICE n'est pas un périphérique bloc valide."
exit 1
fi
if [[ "$DEVICE" == "/dev/nvme0n1" || "$DEVICE" =~ ^/dev/nvme0n1p[0-9]+$ ]]; then
echo "Erreur : $DEVICE correspond au disque interne (nvme0n1). Abandon."
exit 1
fi
ROOT_SRC=$(findmnt -n -o SOURCE / || true)
if [[ -n "$ROOT_SRC" && "$ROOT_SRC" == "$DEVICE"* ]]; then
echo "Erreur : $DEVICE semble contenir la partition racine. Abandon."
exit 1
fi
TRAN=$(lsblk -d -no TRAN "$DEVICE" 2>/dev/null || echo "?")
if [[ "$TRAN" != "usb" ]]; then
echo "Attention : $DEVICE n'est pas détecté comme périphérique USB (TRAN=$TRAN)."
fi
case "$FSTYPE" in
fat32|exfat|ext4) ;;
*)
echo "Erreur : type de système de fichiers non supporté : $FSTYPE"
echo "Choix possibles : fat32, exfat, ext4"
exit 1
;;
esac
if [[ -z "$LABEL" ]]; then
read -rp "Nom de la partition (label) : " LABEL
LABEL="${LABEL:-USB}"
fi
if [[ "$FSTYPE" == "fat32" && ${#LABEL} -gt 11 ]]; then
echo "Attention : FAT32 limite le label à 11 caractères, il sera tronqué."
fi
# --- Nouvelle demande : type de table de partition ---
echo
echo "Choisissez le type de table de partition :"
echo " [1] msdos (MBR) recommandé pour la compatibilité avec les vieux appareils (imprimantes, consoles)"
echo " [2] gpt pour les disques >2To ou l'UEFI moderne"
read -rp "Votre choix (1 ou 2, défaut=1) : " PT_CHOICE
PT_CHOICE="${PT_CHOICE:-1}"
case "$PT_CHOICE" in
1|msdos|mbr) PART_TABLE="msdos" ;;
2|gpt) PART_TABLE="gpt" ;;
*)
echo "Choix invalide, utilisation de msdos par défaut."
PART_TABLE="msdos"
;;
esac
echo "-> Table de partition choisie : $PART_TABLE"
echo "==================================================="
echo " Périphérique : $DEVICE"
echo " Transport : $TRAN"
echo " Système de fichiers: $FSTYPE"
echo " Label : $LABEL"
echo " Table de partition : $PART_TABLE"
echo "==================================================="
lsblk -f "$DEVICE"
echo
echo "TOUTES LES DONNÉES SUR $DEVICE VONT ÊTRE EFFACÉES."
read -rp "Tape le nom du périphérique ($DEVICE) pour confirmer : " CONFIRM
if [[ "$CONFIRM" != "$DEVICE" ]]; then
echo "Confirmation invalide. Abandon."
exit 1
fi
# --- Nettoyage et préparation ---
echo "--> Démontage des partitions existantes..."
for part in "${DEVICE}"?*; do
[[ -b "$part" ]] && sudo umount "$part" 2>/dev/null || true
done
echo "--> Suppression des signatures existantes..."
sudo wipefs -a "$DEVICE"
# --- CORRECTION : forcer le rechargement du périphérique avant parted ---
echo "--> Relecture de la table par le noyau..."
sudo partprobe "$DEVICE" 2>/dev/null || true
sudo udevadm settle
sleep 1
echo "--> Création d'une nouvelle table de partitions ($PART_TABLE)..."
sudo parted -s "$DEVICE" mklabel "$PART_TABLE"
# --- Création de la partition ---
echo "--> Création de la partition..."
sudo parted -s "$DEVICE" mkpart primary 1MiB 100%
sudo partprobe "$DEVICE"
sudo udevadm settle
sleep 1
# Déterminer le nom de la première partition
PART="${DEVICE}1"
[[ "$DEVICE" =~ nvme|mmcblk ]] && PART="${DEVICE}p1"
# Attendre que la partition soit créée
sleep 1
if [[ ! -b "$PART" ]]; then
echo "Erreur : la partition $PART n'a pas été créée."
exit 1
fi
echo "--> Formatage en $FSTYPE..."
case "$FSTYPE" in
fat32)
sudo mkfs.vfat -F32 -n "${LABEL^^}" "$PART"
;;
exfat)
sudo mkfs.exfat -n "$LABEL" "$PART"
;;
ext4)
sudo mkfs.ext4 -L "$LABEL" "$PART"
;;
esac
echo "--> Terminé."
lsblk -f "$DEVICE"

View File

@@ -1,6 +0,0 @@
#!/bin/bash
export GTK_THEME="Adwaita:dark"
killall waybar
sleep 0.5
waybar -c ~/.config/waybar/config.jsonc &
waybar -c ~/.config/waybar/config-hdmi.jsonc &

View File

@@ -1,5 +0,0 @@
#!/bin/bash
export GTK_THEME="Adwaita:dark"
killall waybar
sleep 0.5
waybar -c ~/.config/waybar/config.jsonc &