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

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

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 &

View File

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

View File

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

View File

@@ -1 +0,0 @@
/home/lucas/.config/hyprdynamicmonitors/config-power.toml

View 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"

View File

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

View File

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

View File

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

View 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"

View File

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

View File

@@ -1 +0,0 @@
/usr/lib/systemd/user/hyprdynamicmonitors.service

View File

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

View File

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

View File

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

View File

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

View File

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

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

@@ -0,0 +1,2 @@
#!/bin/bash
systemctl --user edit --full power-monitor.service

View File

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

@@ -6,7 +6,7 @@
}
{
"label" : "logout",
"action" : "hyprctl dispatch exit"
"action" : "hyprctl dispatch 'hl.dsp.exit()'"
"text" : "Déconnecter",
"keybind" : "e"
}