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

@@ -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%-

View File

@@ -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)

View File

@@ -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

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# === 1. Variables denvironnement 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 sils 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 dauthentification Polkit ===
pgrep -x "polkit-kde-authentication-agent-1" >/dev/null || /usr/lib/polkit-kde-authentication-agent-1 &

View File

@@ -0,0 +1,6 @@
#!/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

@@ -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 &