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

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