1
opensuse-setup/scripts/gdm-update-display-settings

31 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
################################################################################
#
# gdm-update-display-settings
# Copies user's current display settings to GDM's config folder
#
################################################################################
# Ensure we're not running as root
if [ "${EUID}" == 0 ]; then
echo "DO NOT RUN THIS SCRIPT AS ROOT!"
echo "Please run this script as a regular user."
exit 1
fi
# Update display settings
sudo cp ${HOME}/.config/monitors.xml /var/lib/gdm/.config/ && echo "Copied .config/monitors.xml to /var/lib/gdm/.config"
# Update pointer settings
MOUSE_SPEED=$(gsettings get org.gnome.desktop.peripherals.mouse speed)
MOUSE_ACCEL_PROFILE=$(gsettings get org.gnome.desktop.peripherals.mouse accel-profile)
TOUCHPAD_SPEED=$(gsettings get org.gnome.desktop.peripherals.touchpad speed)
TOUCHPAD_ACCEL_PROFILE=$(gsettings get org.gnome.desktop.peripherals.touchpad accel-profile)
sudo su -c \
"sudo -u gdm dbus-launch gsettings set org.gnome.desktop.peripherals.mouse speed ${MOUSE_SPEED} &&
sudo -u gdm dbus-launch gsettings set org.gnome.desktop.peripherals.mouse accel-profile "${MOUSE_ACCEL_PROFILE}" &&
sudo -u gdm dbus-launch gsettings set org.gnome.desktop.peripherals.touchpad speed ${TOUCHPAD_SPEED} &&
sudo -u gdm dbus-launch gsettings set org.gnome.desktop.peripherals.touchpad accel-profile "${TOUCHPAD_ACCEL_PROFILE}" &&
echo Applied pointer speed and acceleration profiles"