Update gdm-monitor.nix

This commit is contained in:
ediblerope 2026-01-11 23:05:31 +00:00 committed by GitHub
parent 3d2cc8b4aa
commit 55c0f5cecc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,44 +1,59 @@
# settings/gdm-monitor-sync.nix # settings/gdm-monitor-sync.nix
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
# Copy monitors.xml to GDM's config directory to prevent display mode changes during login # Copy monitors.xml to GDM's config directory to prevent display mode changes during login
# This eliminates the black screen/signal loss when transitioning from GDM to user session # This eliminates the black screen/signal loss when transitioning from GDM to user session
config = lib.mkIf (config.networking.hostName == "FredOS-Gaming") { config = lib.mkIf (config.networking.hostName == "FredOS-Gaming") {
environment.etc."gdm-monitors.xml" = { # Copy monitors.xml to GDM's config directory
source = pkgs.writeText "monitors.xml" '' environment.etc."gdm-monitors.xml" = {
<monitors version="2"> source = pkgs.writeText "monitors.xml" ''
<configuration> <monitors version="2">
<layoutmode>physical</layoutmode> <configuration>
<logicalmonitor> <layoutmode>physical</layoutmode>
<x>0</x> <logicalmonitor>
<y>0</y> <x>0</x>
<scale>1</scale> <y>0</y>
<primary>yes</primary> <scale>1</scale>
<monitor> <primary>yes</primary>
<monitorspec> <monitor>
<connector>DP-3</connector> <monitorspec>
<vendor>GBT</vendor> <connector>DP-3</connector>
<product>G34WQCP</product> <vendor>GBT</vendor>
<serial>25272B000088</serial> <product>G34WQCP</product>
</monitorspec> <serial>25272B000088</serial>
<mode> </monitorspec>
<width>3440</width> <mode>
<height>1440</height> <width>3440</width>
<rate>190.000</rate> <height>1440</height>
</mode> <rate>190.000</rate>
</monitor> </mode>
</logicalmonitor> </monitor>
</configuration> </logicalmonitor>
</monitors> </configuration>
''; </monitors>
target = "gdm-monitors.xml"; '';
}; target = "gdm-monitors.xml";
};
# Create GDM config directory and symlink the monitors.xml file
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /var/lib/gdm/.config 0711 gdm gdm" "d /var/lib/gdm/.config 0711 gdm gdm"
"L+ /var/lib/gdm/.config/monitors.xml - - - - /etc/gdm-monitors.xml" "L+ /var/lib/gdm/.config/monitors.xml - - - - /etc/gdm-monitors.xml"
]; ];
};
# Log what GDM is actually using
systemd.services.gdm-display-check = {
description = "Log GDM display settings";
wantedBy = [ "gdm.service" ];
after = [ "gdm.service" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.writeShellScript "check-gdm-display" ''
sleep 5
DISPLAY=:1024 ${pkgs.xorg.xrandr}/bin/xrandr > /tmp/gdm-display-info.txt 2>&1 || true
echo "=== GDM monitors.xml ===" >> /tmp/gdm-display-info.txt
cat /var/lib/gdm/.config/monitors.xml >> /tmp/gdm-display-info.txt 2>&1 || true
''}";
};
};
}; # <-- This was missing
} }