Created
May 1, 2023 12:33
-
-
Save murar8/80af35c72edb07d92711c6df1882a4d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Description | Copy the latest monitor configuration to GDM. | |
# Author | Lorenzo Murarotto | |
# Email | lnzmrr@gmail.com | |
shopt -s nullglob # Unmatched globs expand to null. | |
GDM_CONFIG_DIR=/var/lib/gdm/.config | |
GDM_CONFIG_FILE=$GDM_CONFIG_DIR/monitors.xml | |
if [ ! -d $GDM_CONFIG_DIR ]; then | |
echo "GDM configuration directory not present, exiting." | |
exit 1 | |
fi | |
for config in /home/*/.config/monitors.xml; do | |
if [ ! -f "$GDM_CONFIG_FILE" ] || [[ $(date +%s -r "$config") > $(date +%s -r "$GDM_CONFIG_FILE") ]]; then | |
echo "Copying newest file version from '$config' to '$GDM_CONFIG_FILE'." | |
cp "$config" "$GDM_CONFIG_FILE" | |
chown gdm:gdm "$GDM_CONFIG_FILE" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy the latest monitor configuration to gdm at every boot.
Note: If you use GDM under Wayland, you must also use a monitors.xml that was created under Wayland.
More info: https://wiki.archlinux.org/title/GDM
Installation
Install the script:
Make it run before gdm starts
Make the file look like this:
Now the last modified monitor configuration will be applied to gdm at each boot!