Fix hyprland, monitor management and waybar after lua switch
This commit is contained in:
@@ -5,11 +5,8 @@ file:///home/lucas/Musique
|
||||
file:///home/lucas/Vid%C3%A9os
|
||||
file:///home/lucas/T%C3%A9l%C3%A9chargements
|
||||
file:///home/lucas/LocalProjets
|
||||
file:///home/lucas/LocalProjets/04%202Limited/VJ
|
||||
file:///home/lucas/Nextcloud
|
||||
file:///home/lucas/Nextcloud/Projets
|
||||
file:///home/lucas/Nextcloud/Projets/2Limited
|
||||
file:///home/lucas/Nextcloud/Projets/2Limited/Vid%C3%A9os
|
||||
file:///home/lucas/Nextcloud
|
||||
file:///home/lucas/Nextcloud2
|
||||
file:///home/lucas/Nextcloud2/03.%20Associatif/V%C3%A9lo%20Boom%20Boom
|
||||
file:///home/lucas/Nextcloud2/03.%20Associatif/V%C3%A9lo%20Boom%20Boom/01%20Communication
|
||||
|
||||
@@ -45,6 +45,8 @@ env = XCURSOR_SIZE,24
|
||||
|
||||
# --- LANCEMENT AUTOMATIQUE ---
|
||||
exec-once = /home/lucas/scripts/hdm-config-select.sh
|
||||
exec-once = hyprdynamicmonitors run
|
||||
exec-once = sleep 1 && ~/scripts/display-apply.sh
|
||||
exec-once = waybar &
|
||||
exec-once = mako &
|
||||
exec-once = ~/scripts/hypridle-launch &
|
||||
@@ -59,7 +61,6 @@ exec-once = wl-paste --type image --watch cliphist store &
|
||||
exec-once = ~/.config/hypr/scripts/wallpaper.sh &
|
||||
exec-once = gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||
exec-once = gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'
|
||||
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland
|
||||
exec-once = /usr/lib/xdg-desktop-portal-hyprland &
|
||||
exec-once = sleep 1 && /usr/lib/xdg-desktop-portal-gtk &
|
||||
exec-once = sleep 2 && /usr/lib/xdg-desktop-portal -r &
|
||||
@@ -123,9 +124,6 @@ bindm = $mainMod, mouse:273, resizewindow
|
||||
bind = , Print, exec, grim -g "$(slurp)" - | wl-copy
|
||||
bind = SHIFT, Print, exec, grimblast copy screen
|
||||
|
||||
# Display manager
|
||||
bind = $mainMod, P, exec, ~/scripts/display-manager.sh
|
||||
|
||||
# Contrôles Hardware
|
||||
bindel = , XF86MonBrightnessUp, exec, brightnessctl set 5%+
|
||||
bindel = , XF86MonBrightnessDown, exec, brightnessctl set 5%-
|
||||
@@ -67,7 +67,8 @@ hl.bind(mainMod .. " + D", hl.dsp.exec_cmd("rofi -show drun"))
|
||||
hl.bind(mainMod .. " + L", hl.dsp.exec_cmd("hyprlock"))
|
||||
hl.bind(mainMod .. " + V", hl.dsp.exec_cmd("cliphist list | rofi -dmenu | cliphist decode | wl-copy"))
|
||||
hl.bind(mainMod .. " + W", hl.dsp.exec_cmd("thunar"))
|
||||
hl.bind(mainMod .. " + P", hl.dsp.exec_cmd("~/scripts/display-manager.sh"))
|
||||
hl.bind(mainMod .. " + SHIFT + P", hl.dsp.exec_cmd("/home/lucas/.config/hyprdynamicmonitors/scripts/display-manager.sh"))
|
||||
hl.bind(mainMod .. " + P", hl.dsp.exec_cmd("/home/lucas/.config/hyprdynamicmonitors/scripts/display-toggle.sh"))
|
||||
|
||||
-- Gestion des fenêtres
|
||||
hl.bind(mainMod .. " + Q", hl.dsp.window.close())
|
||||
@@ -161,27 +162,5 @@ hl.config({
|
||||
|
||||
-- === DÉMARRAGE AUTOMATIQUE (exec-once) ===
|
||||
hl.on("hyprland.start", function()
|
||||
hl.exec_cmd("/home/lucas/scripts/hdm-config-select.sh")
|
||||
hl.exec_cmd(
|
||||
"bash -c 'while [ $(hyprctl monitors | grep -c \"Monitor\") -lt 2 ]; do sleep 1; done; hyprdynamicmonitors'"
|
||||
)
|
||||
hl.exec_cmd("waybar")
|
||||
hl.exec_cmd("mako")
|
||||
hl.exec_cmd("~/scripts/hypridle-launch")
|
||||
hl.exec_cmd("nm-applet --indicator")
|
||||
hl.exec_cmd("blueman-applet")
|
||||
hl.exec_cmd("kdeconnectd")
|
||||
hl.exec_cmd("xdg-user-dirs-update")
|
||||
hl.exec_cmd("xapp-sn-watcher")
|
||||
hl.exec_cmd("/usr/lib/polkit-kde-authentication-agent-1")
|
||||
hl.exec_cmd("wl-paste --type text --watch cliphist store")
|
||||
hl.exec_cmd("wl-paste --type image --watch cliphist store")
|
||||
hl.exec_cmd("~/.config/hypr/scripts/wallpaper.sh")
|
||||
hl.exec_cmd("gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'")
|
||||
hl.exec_cmd("gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'")
|
||||
hl.exec_cmd("dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland")
|
||||
hl.exec_cmd("/usr/lib/xdg-desktop-portal-hyprland")
|
||||
-- Les portails avec délai
|
||||
hl.exec_cmd("sleep 1 && /usr/lib/xdg-desktop-portal-gtk")
|
||||
hl.exec_cmd("sleep 2 && /usr/lib/xdg-desktop-portal -r")
|
||||
end)
|
||||
hl.exec_cmd("~/.config/hypr/scripts/autostart.sh")
|
||||
end)
|
||||
|
||||
@@ -1,11 +1 @@
|
||||
# Generated with hyprdynamicmonitors freeze.
|
||||
# This is a template that you can edit, it is just a starter that pulled your current monitor setup,
|
||||
# adjust as needed.
|
||||
# You can use templates here etc, see https://github.com/fiffeek/hyprdynamicmonitors/blob/main/examples/basic/hyprconfigs/template.go.tmpl.
|
||||
# Monitors are given arbitrary tags (the "monitor" prefix and the ID coming from hyprland).
|
||||
# If you are using tui to edit, leave this at the end of your file (the last monitor config applies)
|
||||
# and leave the markers.
|
||||
# <<<<< TUI AUTO START
|
||||
monitor=desc:BOE 0x0B29,2560x1600@120.00,320x1440,1.33333333,transform,0,vrr,0
|
||||
monitor=desc:Shenzhen KTC Technology Group H27T7P-2 0000000000000,2560x1440@119.99800,0x0,1.00000000,transform,0,vrr,0
|
||||
# <<<<< TUI AUTO END
|
||||
monitor=desc:BOE 0x0B29,2560x1600@120.00,0x0,1.33333333,transform,0,vrr,0
|
||||
|
||||
37
.config/hypr/scripts/autostart.sh
Executable file
37
.config/hypr/scripts/autostart.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# === 1. Variables d’environnement pour Hyprland ===
|
||||
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=Hyprland
|
||||
|
||||
# === 2. Configuration dynamique des moniteurs ===
|
||||
# Ce script choisit le bon fichier config.toml (eco/power) et lance hyprdynamicmonitors
|
||||
~/.config/hypr/scripts/monitors-setup.sh &
|
||||
|
||||
# === 3. Portails XDG (démarrer uniquement s’ils ne tournent pas) ===
|
||||
pgrep -x "xdg-desktop-portal-hyprland" >/dev/null || /usr/lib/xdg-desktop-portal-hyprland &
|
||||
pgrep -x "xdg-desktop-portal-gtk" >/dev/null || /usr/lib/xdg-desktop-portal-gtk &
|
||||
|
||||
# === 4. Services graphiques (vérification avant lancement) ===
|
||||
pgrep -x "waybar" >/dev/null || waybar &
|
||||
pgrep -x "mako" >/dev/null || mako &
|
||||
pgrep -x "nm-applet" >/dev/null || nm-applet --indicator &
|
||||
pgrep -x "blueman-applet" >/dev/null || blueman-applet &
|
||||
pgrep -x "kdeconnectd" >/dev/null || kdeconnectd &
|
||||
|
||||
# === 5. Gestion de la veille (hypridle) ===
|
||||
if [ -x ~/.config/hypr/scripts/hypridle-launch.sh ]; then
|
||||
~/.config/hypr/scripts/hypridle-launch.sh &
|
||||
else
|
||||
hypridle &
|
||||
fi
|
||||
|
||||
# === 6. Fond d’écran ===
|
||||
[ -x ~/.config/hypr/scripts/wallpaper.sh ] && ~/.config/hypr/scripts/wallpaper.sh &
|
||||
|
||||
# === 7. Gestion du presse-papiers (cliphist) ===
|
||||
wl-paste --type text --watch cliphist store &
|
||||
wl-paste --type image --watch cliphist store &
|
||||
wl-paste --primary --type text --watch cliphist store &
|
||||
|
||||
# === 8. Agent d’authentification Polkit ===
|
||||
pgrep -x "polkit-kde-authentication-agent-1" >/dev/null || /usr/lib/polkit-kde-authentication-agent-1 &
|
||||
22
.config/hypr/scripts/monitors-setup.sh
Executable file
22
.config/hypr/scripts/monitors-setup.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
CONFIG_DIR="$HOME/.config/hyprdynamicmonitors"
|
||||
|
||||
# 1. Sélection du fichier de configuration selon le mode d'alimentation
|
||||
if grep -q "eco_mode=1" /proc/cmdline; then
|
||||
ln -sf "$CONFIG_DIR/config-eco.toml" "$CONFIG_DIR/config.toml"
|
||||
else
|
||||
ln -sf "$CONFIG_DIR/config-power.toml" "$CONFIG_DIR/config.toml"
|
||||
fi
|
||||
|
||||
# 2. Vérifier que le fichier de configuration existe avant de le modifier
|
||||
if [ -f "$CONFIG_DIR/config.toml" ]; then
|
||||
sed -i 's/^mode = ".*"/mode = "both"/' "$CONFIG_DIR/config.toml"
|
||||
else
|
||||
echo "Erreur : $CONFIG_DIR/config.toml introuvable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 3. Lancement du démon
|
||||
hyprdynamicmonitors &
|
||||
@@ -9,12 +9,14 @@ path = "/org/freedesktop/UPower/devices/line_power_AC"
|
||||
[[power_events.dbus_signal_match_rules]]
|
||||
object_path = "/org/freedesktop/UPower/devices/line_power_AC"
|
||||
|
||||
|
||||
[profiles.dual]
|
||||
config_file = "/home/lucas/.config/hyprdynamicmonitors/hyprconfigs/dual.go.tmpl"
|
||||
config_file = "/home/lucas/.config/hyprdynamicmonitors/hyprconfigs/dual-eco.go.tmpl"
|
||||
config_file_type = "template"
|
||||
[profiles.dual.conditions]
|
||||
|
||||
[profiles.dual.static_template_values]
|
||||
mode = "both"
|
||||
|
||||
[[profiles.dual.conditions.required_monitors]]
|
||||
description = "BOE 0x0B29"
|
||||
monitor_tag = "monitor0"
|
||||
@@ -24,7 +26,7 @@ description = "Shenzhen KTC Technology Group H27T7P-2 0000000000000"
|
||||
monitor_tag = "monitor1"
|
||||
|
||||
[profiles.solo]
|
||||
config_file = "/home/lucas/.config/hyprdynamicmonitors/hyprconfigs/solo.go.tmpl"
|
||||
config_file = "/home/lucas/.config/hyprdynamicmonitors/hyprconfigs/solo-eco.go.tmpl"
|
||||
config_file_type = "template"
|
||||
|
||||
[profiles.solo.conditions]
|
||||
|
||||
@@ -15,6 +15,9 @@ config_file = "/home/lucas/.config/hyprdynamicmonitors/hyprconfigs/dual.go.tmpl"
|
||||
config_file_type = "template"
|
||||
[profiles.dual.conditions]
|
||||
|
||||
[profiles.dual.static_template_values]
|
||||
mode = ""
|
||||
|
||||
[[profiles.dual.conditions.required_monitors]]
|
||||
description = "BOE 0x0B29"
|
||||
monitor_tag = "monitor0"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/home/lucas/.config/hyprdynamicmonitors/config-power.toml
|
||||
40
.config/hyprdynamicmonitors/config.toml
Normal file
40
.config/hyprdynamicmonitors/config.toml
Normal file
@@ -0,0 +1,40 @@
|
||||
[general]
|
||||
destination = "$HOME/.config/hypr/monitors.conf"
|
||||
|
||||
[power_events]
|
||||
|
||||
[power_events.dbus_query_object]
|
||||
path = "/org/freedesktop/UPower/devices/line_power_AC"
|
||||
|
||||
[[power_events.dbus_signal_match_rules]]
|
||||
object_path = "/org/freedesktop/UPower/devices/line_power_AC"
|
||||
|
||||
|
||||
[profiles.dual]
|
||||
config_file = "/home/lucas/.config/hyprdynamicmonitors/hyprconfigs/dual.go.tmpl"
|
||||
config_file_type = "template"
|
||||
[profiles.dual.conditions]
|
||||
|
||||
[profiles.dual.static_template_values]
|
||||
mode = "both"
|
||||
|
||||
[[profiles.dual.conditions.required_monitors]]
|
||||
description = "BOE 0x0B29"
|
||||
monitor_tag = "monitor0"
|
||||
|
||||
[[profiles.dual.conditions.required_monitors]]
|
||||
description = "Shenzhen KTC Technology Group H27T7P-2 0000000000000"
|
||||
monitor_tag = "monitor1"
|
||||
|
||||
[profiles.solo]
|
||||
config_file = "/home/lucas/.config/hyprdynamicmonitors/hyprconfigs/solo.go.tmpl"
|
||||
config_file_type = "template"
|
||||
|
||||
[profiles.solo.conditions]
|
||||
[[profiles.solo.conditions.required_monitors]]
|
||||
description = "BOE 0x0B29"
|
||||
monitor_tag = "monitor0"
|
||||
|
||||
[fallback_profile]
|
||||
config_file = "/home/lucas/.config/hyprdynamicmonitors/hyprconfigs/fallback.go.tmpl"
|
||||
config_file_type = "template"
|
||||
@@ -1,11 +1,14 @@
|
||||
# Generated with hyprdynamicmonitors freeze.
|
||||
# This is a template that you can edit, it is just a starter that pulled your current monitor setup,
|
||||
# adjust as needed.
|
||||
# You can use templates here etc, see https://github.com/fiffeek/hyprdynamicmonitors/blob/main/examples/basic/hyprconfigs/template.go.tmpl.
|
||||
# Monitors are given arbitrary tags (the "monitor" prefix and the ID coming from hyprland).
|
||||
# If you are using tui to edit, leave this at the end of your file (the last monitor config applies)
|
||||
# and leave the markers.
|
||||
# mode: "laptop" = interne seul, "external" = externe seul, sinon (both/vide) = les deux
|
||||
{{ if eq .mode "laptop" }}
|
||||
monitor=desc:BOE 0x0B29,2560x1600@48.00,0x0,1.33333333,transform,0,vrr,0
|
||||
monitor=desc:Shenzhen KTC Technology Group H27T7P-2 0000000000000,disable
|
||||
{{ else if eq .mode "external" }}
|
||||
monitor=desc:BOE 0x0B29,disable
|
||||
monitor=desc:Shenzhen KTC Technology Group H27T7P-2 0000000000000,2560x1440@119.99800,0x0,1.00000000,transform,0,vrr,0
|
||||
{{ else }}
|
||||
# <<<<< TUI AUTO START
|
||||
monitor=desc:BOE 0x0B29,2560x1600@48.00,320x1440,1.33333333,transform,0,vrr,0
|
||||
monitor=desc:Shenzhen KTC Technology Group H27T7P-2 0000000000000,2560x1440@119.99800,0x0,1.00000000,transform,0,vrr,0
|
||||
# <<<<< TUI AUTO END
|
||||
{{ end }}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
# Generated with hyprdynamicmonitors freeze.
|
||||
# This is a template that you can edit, it is just a starter that pulled your current monitor setup,
|
||||
# adjust as needed.
|
||||
# You can use templates here etc, see https://github.com/fiffeek/hyprdynamicmonitors/blob/main/examples/basic/hyprconfigs/template.go.tmpl.
|
||||
# Monitors are given arbitrary tags (the "monitor" prefix and the ID coming from hyprland).
|
||||
# If you are using tui to edit, leave this at the end of your file (the last monitor config applies)
|
||||
# and leave the markers.
|
||||
# mode: "laptop" = interne seul, "external" = externe seul, sinon (both/vide) = les deux
|
||||
{{ if eq .mode "laptop" }}
|
||||
monitor=desc:BOE 0x0B29,2560x1600@120.00,0x0,1.33333333,transform,0,vrr,0
|
||||
monitor=desc:Shenzhen KTC Technology Group H27T7P-2 0000000000000,disable
|
||||
{{ else if eq .mode "external" }}
|
||||
monitor=desc:BOE 0x0B29,disable
|
||||
monitor=desc:Shenzhen KTC Technology Group H27T7P-2 0000000000000,2560x1440@119.99800,0x0,1.00000000,transform,0,vrr,0
|
||||
{{ else }}
|
||||
# <<<<< TUI AUTO START
|
||||
monitor=desc:BOE 0x0B29,2560x1600@120.00,320x1440,1.33333333,transform,0,vrr,0
|
||||
monitor=desc:Shenzhen KTC Technology Group H27T7P-2 0000000000000,2560x1440@119.99800,0x0,1.00000000,transform,0,vrr,0
|
||||
# <<<<< TUI AUTO END
|
||||
{{ end }}
|
||||
|
||||
30
.config/hyprdynamicmonitors/scripts/display-toggle.sh
Executable file
30
.config/hyprdynamicmonitors/scripts/display-toggle.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
CONFIG="$HOME/.config/hyprdynamicmonitors/config.toml"
|
||||
|
||||
get_current_mode() {
|
||||
grep -m1 '^mode = "' "$CONFIG" | sed 's/^mode = "\(.*\)"/\1/'
|
||||
}
|
||||
|
||||
set_mode() {
|
||||
local new_mode="$1"
|
||||
sed -i --follow-symlinks 's/^mode = ".*"/mode = "'"$new_mode"'"/' "$CONFIG"
|
||||
}
|
||||
|
||||
current=$(get_current_mode)
|
||||
|
||||
case "$current" in
|
||||
both) next="external" ;;
|
||||
external) next="laptop" ;;
|
||||
laptop) next="both" ;;
|
||||
*) next="both" ;;
|
||||
esac
|
||||
|
||||
set_mode "$next"
|
||||
|
||||
# Redémarrage de hyprdynamicmonitors pour appliquer la nouvelle config
|
||||
pkill -x hyprdynamicmonitors 2>/dev/null || true
|
||||
hyprdynamicmonitors &
|
||||
|
||||
notify-send "Écrans" "Mode : $next"
|
||||
@@ -43,10 +43,10 @@ video/mp4=mpv.desktop;
|
||||
application/x-zerosize=codium.desktop;onlyoffice-desktopeditors.desktop;
|
||||
image/jpeg=com.github.PintaProject.Pinta.desktop;imv.desktop;nsxiv.desktop;viewnior.desktop;
|
||||
image/png=com.github.PintaProject.Pinta.desktop;imv.desktop;viewnior.desktop;
|
||||
application/pdf=firefox.desktop;onlyoffice-desktopeditors.desktop;
|
||||
application/pdf=org.inkscape.Inkscape.desktop;com.collaboraoffice.Office.desktop;firefox.desktop;onlyoffice-desktopeditors.desktop;
|
||||
audio/x-opus+ogg=mpv.desktop;
|
||||
audio/flac=mpv.desktop;
|
||||
text/csv=onlyoffice-desktopeditors.desktop;codium.desktop;
|
||||
text/csv=codium.desktop;onlyoffice-desktopeditors.desktop;
|
||||
video/x-matroska=mpv.desktop;
|
||||
application/json=codium.desktop;
|
||||
video/webm=mpv.desktop;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/usr/lib/systemd/user/hyprdynamicmonitors.service
|
||||
@@ -4,7 +4,7 @@ After=graphical-session.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/home/lucas/scripts/power-monitor
|
||||
ExecStart=/home/lucas/.config/waybar/scripts/power-monitor.sh
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
{
|
||||
"output": "HDMI-A-1",
|
||||
"position": "bottom",
|
||||
"layer": "top",
|
||||
"height": 36,
|
||||
"spacing": 3,
|
||||
"modules-left": [
|
||||
"hyprland/workspaces",
|
||||
"hyprland/submap"
|
||||
],
|
||||
"modules-center": [
|
||||
"hyprland/window"
|
||||
],
|
||||
"modules-right": [
|
||||
"pulseaudio",
|
||||
"pulseaudio#microphone",
|
||||
"network",
|
||||
"cpu",
|
||||
"memory",
|
||||
"temperature",
|
||||
"backlight",
|
||||
"custom/battery",
|
||||
"clock",
|
||||
"tray",
|
||||
"custom/power"
|
||||
],
|
||||
|
||||
// Le module workspaces s'adapte selon l'écran
|
||||
"hyprland/workspaces": {
|
||||
"format": "{name} {icon}",
|
||||
"on-click": "activate",
|
||||
"format-icons": {
|
||||
"active": "",
|
||||
"default": "",
|
||||
"empty": ""
|
||||
},
|
||||
"all-outputs": false,
|
||||
// Ici on définit les workspaces persistants pour chaque écran
|
||||
"persistent-workspaces": {
|
||||
"eDP-1": [1, 2, 3],
|
||||
"HDMI-A-1": [4, 5, 6]
|
||||
}
|
||||
},
|
||||
|
||||
"hyprland/window": {
|
||||
"format": " {title}",
|
||||
"rewrite": {
|
||||
"(.*) — Mozilla Firefox": " Firefox",
|
||||
"(.*) - Visual Studio Code": " VS Code",
|
||||
"(.*)vlc": " VLC",
|
||||
"lucas@dell16-lucas:(.*)": " Terminal"
|
||||
},
|
||||
"separate-outputs": true
|
||||
},
|
||||
|
||||
"pulseaudio": {
|
||||
"format": "{icon} {volume}%",
|
||||
"format-muted": " {volume}%",
|
||||
"format-icons": {
|
||||
"default": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
},
|
||||
"on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
|
||||
"on-click-right": "pavucontrol"
|
||||
},
|
||||
"pulseaudio#microphone": {
|
||||
"type": "pulseaudio",
|
||||
"format": "{format_source}",
|
||||
"format-source": " {volume}%",
|
||||
"format-source-muted": "",
|
||||
"on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
|
||||
"on-click-right": "pavucontrol"
|
||||
},
|
||||
"network": {
|
||||
"interval": 10,
|
||||
"format-wifi": "{icon} {essid} {signalStrength}%",
|
||||
"format-icons": [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"format-ethernet": " {ifname}",
|
||||
"format-disconnected": " Disconnected",
|
||||
"format-alt": "{ipaddr}/{cidr}",
|
||||
"on-click-right": "networkmanager_dmenu"
|
||||
},
|
||||
"cpu": {
|
||||
"interval": 5,
|
||||
"format": " {usage}%",
|
||||
"tooltip": false,
|
||||
"on-click": "alacritty -e btop"
|
||||
},
|
||||
"memory": {
|
||||
"interval": 5,
|
||||
"format": " {percentage}%",
|
||||
"on-click": "alacritty -e btop"
|
||||
},
|
||||
"temperature": {
|
||||
"interval": 5,
|
||||
"hwmon-path": "/sys/class/hwmon/hwmon7/temp1_input",
|
||||
"critical-threshold": 80,
|
||||
"format-critical": "{icon} {temperatureC}°C",
|
||||
"format": "{icon} {temperatureC}°C",
|
||||
"format-icons": [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"tooltip": false,
|
||||
"on-click": "alacritty -e btop"
|
||||
},
|
||||
"backlight": {
|
||||
"format": "{icon} {percent}%",
|
||||
"format-icons": [
|
||||
"",
|
||||
""
|
||||
]
|
||||
},
|
||||
"custom/battery": {
|
||||
"exec": "~/scripts/batt-info",
|
||||
"interval": 2,
|
||||
"on-click": "~/scripts/batt-toggle",
|
||||
"on-click-right": "",
|
||||
"tooltip-format": "Clic: basculer limite charge"
|
||||
},
|
||||
"clock": {
|
||||
"format": " {:%H:%M}",
|
||||
"format-alt": " {:%d/%m/%Y}",
|
||||
"smooth-scrolling-threshold": 1,
|
||||
"actions": {
|
||||
"on-scroll-up": "shift_up",
|
||||
"on-scroll-down": "shift_down"
|
||||
},
|
||||
"tooltip-format": "{calendar}",
|
||||
"calendar": {
|
||||
"mode": "month",
|
||||
"mode-mon-col": 1,
|
||||
"format": {
|
||||
"months": "<span color='#cba6f7'><b>{}</b></span>",
|
||||
"days": "<span color='#bac2de'>{}</span>",
|
||||
"weekdays": "<span color='#89b4fa'><b>{}</b></span>",
|
||||
"today": "<span color='#f38ba8'><b><u>{}</u></b></span>"
|
||||
}
|
||||
}
|
||||
},
|
||||
"custom/power": {
|
||||
"format": "⏻",
|
||||
"on-click": "wlogout"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"output": "eDP-1",
|
||||
"output": ["eDP-1", "HDMI-A-1"], // ← les deux écrans
|
||||
"position": "bottom",
|
||||
"layer": "top",
|
||||
"height": 36,
|
||||
@@ -25,7 +25,6 @@
|
||||
"custom/power"
|
||||
],
|
||||
|
||||
// Le module workspaces s'adapte selon l'écran
|
||||
"hyprland/workspaces": {
|
||||
"format": "{name} {icon}",
|
||||
"on-click": "activate",
|
||||
@@ -35,7 +34,7 @@
|
||||
"empty": ""
|
||||
},
|
||||
"all-outputs": false,
|
||||
// Ici on définit les workspaces persistants pour chaque écran
|
||||
// Les workspaces persistants sont déjà différenciés par sortie
|
||||
"persistent-workspaces": {
|
||||
"eDP-1": [1, 2, 3],
|
||||
"HDMI-A-1": [4, 5, 6]
|
||||
@@ -57,11 +56,7 @@
|
||||
"format": "{icon} {volume}%",
|
||||
"format-muted": " {volume}%",
|
||||
"format-icons": {
|
||||
"default": [
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
"default": ["", "", ""]
|
||||
},
|
||||
"on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
|
||||
"on-click-right": "pavucontrol"
|
||||
@@ -71,19 +66,14 @@
|
||||
"format": "{format_source}",
|
||||
"format-source": " {volume}%",
|
||||
"format-source-muted": "",
|
||||
"on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
|
||||
// CORRECTION : on mute la source (micro) et non le sink
|
||||
"on-click": "pactl set-source-mute @DEFAULT_SOURCE@ toggle",
|
||||
"on-click-right": "pavucontrol"
|
||||
},
|
||||
"network": {
|
||||
"interval": 10,
|
||||
"format-wifi": "{icon} {essid} {signalStrength}%",
|
||||
"format-icons": [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"format-icons": ["", "", "", "", ""],
|
||||
"format-ethernet": " {ifname}",
|
||||
"format-disconnected": " Disconnected",
|
||||
"format-alt": "{ipaddr}/{cidr}",
|
||||
@@ -102,31 +92,23 @@
|
||||
},
|
||||
"temperature": {
|
||||
"interval": 5,
|
||||
// Remplacez par le chemin qui fonctionne sur votre machine
|
||||
"hwmon-path": "/sys/class/hwmon/hwmon7/temp1_input",
|
||||
"critical-threshold": 80,
|
||||
"format-critical": "{icon} {temperatureC}°C",
|
||||
"format": "{icon} {temperatureC}°C",
|
||||
"format-icons": [
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"format-icons": ["", "", "", "", ""],
|
||||
"tooltip": false,
|
||||
"on-click": "alacritty -e btop"
|
||||
},
|
||||
"backlight": {
|
||||
"format": "{icon} {percent}%",
|
||||
"format-icons": [
|
||||
"",
|
||||
""
|
||||
]
|
||||
"format-icons": ["", ""]
|
||||
},
|
||||
"custom/battery": {
|
||||
"exec": "~/scripts/batt-info",
|
||||
"exec": "/home/lucas/.config/waybar/scripts/batt-info.sh",
|
||||
"interval": 2,
|
||||
"on-click": "~/scripts/batt-toggle",
|
||||
"on-click": "/home/lucas/.config/waybar/scripts/batt-toggle.sh",
|
||||
"on-click-right": "",
|
||||
"tooltip-format": "Clic: basculer limite charge"
|
||||
},
|
||||
@@ -154,4 +136,4 @@
|
||||
"format": "⏻",
|
||||
"on-click": "wlogout"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
{
|
||||
"position": "bottom",
|
||||
"layer": "top",
|
||||
"height": 34,
|
||||
"spacing": 3,
|
||||
|
||||
"modules-left": ["hyprland/workspaces", "hyprland/submap"],
|
||||
"modules-center": ["hyprland/window"],
|
||||
"modules-right": [
|
||||
"pulseaudio",
|
||||
"pulseaudio#microphone",
|
||||
"network",
|
||||
"cpu",
|
||||
"memory",
|
||||
"temperature",
|
||||
"backlight",
|
||||
"battery",
|
||||
"clock",
|
||||
"tray",
|
||||
"custom/power"
|
||||
],
|
||||
|
||||
"pulseaudio": {
|
||||
"format": "{icon} {volume}%",
|
||||
"format-muted": "",
|
||||
"format-icons": {
|
||||
"default": ["", "", ""]
|
||||
},
|
||||
"on-click": "pavucontrol"
|
||||
},
|
||||
|
||||
"pulseaudio#microphone": {
|
||||
"format": "{format_source}",
|
||||
"format-source": " {volume}%",
|
||||
"format-source-muted": "",
|
||||
"on-click": "pamixer --default-source -t"
|
||||
},
|
||||
|
||||
"network": {
|
||||
"interval": 10,
|
||||
"format-wifi": "{icon} {essid} {signalStrength}%",
|
||||
"format-icons": ["", "", "", "", ""],
|
||||
"format-ethernet": " {ifname}",
|
||||
"format-disconnected": " Disconnected",
|
||||
// Clic gauche : Bascule l'affichage vers l'IP (format-alt)
|
||||
// Pas de commande nécessaire, c'est le comportement natif de Waybar au clic
|
||||
"format-alt": "{ipaddr}/{cidr}",
|
||||
// Clic droit : Ouvre le menu de NetworkManager
|
||||
"on-click-right": "networkmanager_dmenu"
|
||||
},
|
||||
|
||||
"cpu": {
|
||||
"interval": 5,
|
||||
"format": " {usage}%",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"memory": {
|
||||
"interval": 5,
|
||||
"format": " {percentage}%", // Vérifiez bien l'espace entre l'icône et le texte
|
||||
},
|
||||
|
||||
"temperature": {
|
||||
"interval": 5,
|
||||
"hwmon-path": "/sys/class/hwmon/hwmon7/temp1_input",
|
||||
"critical-threshold": 80,
|
||||
"format-critical": "{icon} {temperatureC}°C",
|
||||
"format": "{icon} {temperatureC}°C",
|
||||
"format-icons": ["", "", "", "", ""],
|
||||
"tooltip": true
|
||||
},
|
||||
|
||||
"backlight": {
|
||||
"format": "{icon} {percent}%",
|
||||
"format-icons": ["", ""]
|
||||
},
|
||||
|
||||
"battery": {
|
||||
"states": {
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"format": "{icon} {capacity}%",
|
||||
"format-charging": " {capacity}%",
|
||||
"format-plugged": " {capacity}%",
|
||||
"format-icons": ["", "", "", "", ""]
|
||||
},
|
||||
|
||||
"clock": {
|
||||
"format": " {:%H:%M}",
|
||||
"format-alt": " {:%d/%m/%Y}",
|
||||
"tooltip-format": "<span color='#cba6f7' font='JetBrainsMono Nerd Font 12'><big>{:%Y %B}</big></span>\n<tt><small>{calendar}</small></tt>",
|
||||
"calendar": {
|
||||
"mode" : "month",
|
||||
"mode-mon-col" : 3,
|
||||
"on-scroll" : 1,
|
||||
"format": {
|
||||
"months": "<span color='#cdd6f4'><b>{}</b></span>",
|
||||
"days": "<span color='#bac2de'>{}</span>",
|
||||
"weekdays": "<span color='#89b4fa'><b>{}</b></span>",
|
||||
"today": "<span color='#f38ba8'><b><u>{}</u></b></span>"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"custom/power": {
|
||||
"format": "⏻",
|
||||
"on-click": "wlogout"
|
||||
}
|
||||
}
|
||||
2
.config/waybar/scripts/power-monitor-edit-service.sh
Executable file
2
.config/waybar/scripts/power-monitor-edit-service.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
systemctl --user edit --full power-monitor.service
|
||||
@@ -6,7 +6,7 @@
|
||||
}
|
||||
{
|
||||
"label" : "logout",
|
||||
"action" : "hyprctl dispatch exit"
|
||||
"action" : "hyprctl dispatch 'hl.dsp.exit()'"
|
||||
"text" : "Déconnecter",
|
||||
"keybind" : "e"
|
||||
}
|
||||
|
||||
4
.zshrc
4
.zshrc
@@ -51,8 +51,8 @@ export TERMINAL=alacritty
|
||||
bindkey '^[[3~' delete-char
|
||||
|
||||
# Update and clean
|
||||
alias update='yay -Syu --noconfirm && yay -Yc --noconfirm && sudo mkinitcpio -P && sudo /home/lucas/scripts/mkinitcpio-eco && rm -f ~/.cache/updates-count && clean'
|
||||
alias clean='/home/lucas/scripts/clean.sh'
|
||||
alias update='yay -Syu --noconfirm && yay -Yc --noconfirm && sudo mkinitcpio -P && sudo /home/lucas/scripts/update/mkinitcpio-eco && rm -f ~/.cache/updates-count && clean'
|
||||
alias clean='/home/lucas/scripts/update/clean.sh'
|
||||
alias clr='clear'
|
||||
alias dotpush='~/scripts/dotpush.sh'
|
||||
alias etcpush='sudo etckeeper commit "Sauvegarde auto $(date "+%Y-%m-%d %H:%M")"'
|
||||
|
||||
@@ -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
|
||||
@@ -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é."
|
||||
46
scripts/update/pkglist_aur.txt
Normal file
46
scripts/update/pkglist_aur.txt
Normal 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
|
||||
210
scripts/update/pkglist_officiel.txt
Normal file
210
scripts/update/pkglist_officiel.txt
Normal 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
147
scripts/utilities/format.sh
Executable 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 >2 To 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"
|
||||
@@ -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 &
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
export GTK_THEME="Adwaita:dark"
|
||||
killall waybar
|
||||
sleep 0.5
|
||||
waybar -c ~/.config/waybar/config.jsonc &
|
||||
Reference in New Issue
Block a user