#!/bin/bash

read -r signature < /tmp/hyprland_instance_signature
export HYPRLAND_INSTANCE_SIGNATURE="$signature"
export XDG_RUNTIME_DIR="/run/user/1000"
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
if [ "$1" == "connected" ]; then
    /usr/bin/hyprctl keyword monitor "eDP-1,2880x1800@120,0x0,1.5,vrr,1,bitdepth,10"
else
    /usr/bin/hyprctl keyword monitor "eDP-1,2880x1800@60,0x0,1.5"
fi

#!/bin/bash
LOCKFILE="/tmp/hypr-monitor-switch.lock"

# Crea un archivo de bloqueo temporal
exec 200>$LOCKFILE
flock -n 200 || exit 1

# Script de ajuste de frecuencia de refresco
if [[ "$1" == "disconnected" ]]; then
    hyprctl keyword monitor "eDP-1,2880x1800@60,0x0,1.5"
    echo "Set to 60Hz" >> /tmp/udev-hypr-monitor.log
elif [[ "$1" == "connected" ]]; then
    hyprctl keyword monitor "eDP-1,2880x1800@120,0x0,1.5,vrr,1,bitdepth,10"
    echo "Set to 120Hz" >> /tmp/udev-hypr-monitor.log
fi
