Fix hyprland, monitor management and waybar after lua switch
This commit is contained in:
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"
|
||||
Reference in New Issue
Block a user