This shows you the differences between two versions of the page.
linux:lxde_dual-monitor_setup [2013/05/02 18:53] clee231 [/etc/lxdm/PostLogout] updated with Walter's fix for crashing lxdm on logout |
linux:lxde_dual-monitor_setup [2021/05/02 21:36] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Setup ====== | ||
- | Workstations with a dual-monitor setup have some issues with deciding which monitor to use as the primary monitor. This will cause some issues with some games, applications, and issues with screen alignment. | ||
- | In order to fix these issues, Josh Kilmer (jkilmer) (srjek) has written some scripts to aid in the process of setup. | ||
- | |||
- | <code> | ||
- | # Begin Josh Kilmer's (jkilmer)(srjek) dualmonitor script | ||
- | xrandr --output DVI-I-3 --off # Turn off secondary monitor to fix window snapping alignment issue | ||
- | xrandr --auto # For connected but disabled outputs, this will enable them using their preferred mode | ||
- | xrandr --output DVI-I-3 --left-of DVI-I-2 # Set secondary monitor to be on the left (DVI-3) | ||
- | xrandr --output DVI-I-2 --primary # Set primary monitor to the on on the right (DVI-2) | ||
- | # End Josh Kilmer's (jkilmer)(srjek) dualmonitor script | ||
- | </code> | ||
- | |||
- | Please note that this has only been testing on the HP workstations running Arch, and have not been extensively testing on single-monitor setups and the like. | ||
- | |||
- | ====== Running at Login ====== | ||
- | --- //[[clee231@uic.edu|Chase Lee]] 2013/04/27 02:19// | ||
- | |||
- | In order to automate this process,(instead of making users do this themselves) we can put this script in the corresponding LXDM configurations files. The LXDM files are run at specific times during the login and logout process. Appending these commands will automatically setup the dual-monitor layout. | ||
- | |||
- | The following are copies of the modified LXDM configurations files as of April 27, 2013: | ||
- | Note that these settings should not be applied to single-monitor setups, as this may result in unintended results. | ||
- | |||
- | ==== /etc/lxdm/PreShutdown ==== | ||
- | <code>#!/bin/sh | ||
- | # | ||
- | # Note: this is a sample and will not be run as is. | ||
- | </code> | ||
- | |||
- | ==== /etc/lxdm/PostLogin ==== | ||
- | <code>#!/bin/sh | ||
- | # | ||
- | # Note: this is a sample and will not be run as is. | ||
- | #loltask > /dev/null & | ||
- | thunar --daemon & | ||
- | #if [ ! -d "/home/$USER/Steam" ] | ||
- | #then | ||
- | # mkdir /home/$USER/Steam | ||
- | # echo "/home/$USER/Steam created on $HOSTNAME" >> /var/log/test | ||
- | #fi | ||
- | #sudo /usr/local/bin/steamMount $USER | ||
- | </code> | ||
- | |||
- | |||
- | ==== /etc/lxdm/PreReboot ==== | ||
- | <code>#!/bin/sh | ||
- | # | ||
- | # Note: this is a sample and will not be run as is. | ||
- | </code> | ||
- | |||
- | |||
- | ==== /etc/lxdm/PostLogout ==== | ||
- | <code>#!/bin/sh | ||
- | # | ||
- | # Note: this is a sample and will not be run as is. | ||
- | if [ "$USER" == "acmguest" ] | ||
- | then | ||
- | umount /opt/acmguest/.local/share/Steam | ||
- | sudo /usr/local/sbin/guestd restart | ||
- | fi | ||
- | if [ "$USER" == "lol" ] | ||
- | then | ||
- | umount /opt/lol/.local/share/Steam | ||
- | else | ||
- | umount /home/$USER/.local/share/Steam | ||
- | fi | ||
- | killall --user $USER -TERM | ||
- | xsetroot -solid black | ||
- | test -x /usr/bin/pax11publish && /usr/bin/pax11publish -r | ||
- | # this makes sure lxdm is restarted if it crashes | ||
- | if [ ! -z "$(pgrep lxdm)" ] | ||
- | then | ||
- | systemctl restart lxdm | ||
- | fi | ||
- | |||
- | # this forces users t o logout | ||
- | loginctl terminate-user user1 user2 | ||
- | |||
- | # Begin Josh Kilmer's (jkilmer)(srjek) dualmonitor script | ||
- | xrandr --output DVI-I-3 --off | ||
- | # End Josh Kilmer's (jkilmer)(srjek) dualmonitor script | ||
- | </code> | ||
- | |||
- | |||
- | ==== /etc/lxdm/PreLogin ==== | ||
- | <code>#!/bin/sh | ||
- | # | ||
- | # Note: this is a sample and will not be run as is. | ||
- | #!/bin/sh | ||
- | # | ||
- | # Note: this is a sample and will not be run as is. | ||
- | #loltask > /dev/null & | ||
- | #mount -B /opt/Steam /home/$USER/Steam | ||
- | #if [ "$?" -ne "0" ] | ||
- | #then | ||
- | # mkdir /home/$USER/Steam | ||
- | # mount -B /opt/Steam /home/$USER/Steam | ||
- | #fi | ||
- | if [ "$USER" == "lol" ] | ||
- | then | ||
- | mount -B /opt/Steamlocal /opt/lol/.local/share/Steam | ||
- | chown -R lol:users /opt/lol/.local/share/Steam | ||
- | else | ||
- | if [ "$USER" == "acmguest" ] | ||
- | then | ||
- | mount -B /opt/Steamlocal /opt/acmguest/.local/share/Steam | ||
- | chown -R acmguest:users /opt/acmguest/.local/share/Steam | ||
- | else | ||
- | mount -B /opt/Steamlocal /home/$USER/.local/share/Steam | ||
- | |||
- | if [ "$?" -ne "0" ] | ||
- | then | ||
- | mkdir /home/$USER/.local/share/Steam | ||
- | mount -B /opt/Steamlocal /home/$USER/.local/share/Steam | ||
- | fi | ||
- | chown -R $USER:users /home/$USER/.local/share/Steam | ||
- | fi | ||
- | fi | ||
- | # Begin Josh Kilmer's (jkilmer)(srjek) dualmonitor script | ||
- | xrandr --output DVI-I-3 --off | ||
- | xrandr --auto | ||
- | xrandr --output DVI-I-3 --left-of DVI-I-2 | ||
- | xrandr --output DVI-I-2 --primary | ||
- | # End Josh Kilmer's (jkilmer)(srjek) dualmonitor script | ||
- | </code> | ||
- | |||
- | |||
- | ==== /etc/lxdm/Xsession ==== | ||
- | <code>#!/bin/bash | ||
- | |||
- | # use bash for "exec -l", howto run login shell by /bin/sh ? | ||
- | |||
- | if [ $# -eq 1 -a -n "$1" ]; then | ||
- | LXSESSION=$1 | ||
- | else | ||
- | # default session | ||
- | LXSESSION=/usr/bin/startlxde | ||
- | fi | ||
- | |||
- | [ -f /etc/profile ] && . /etc/profile | ||
- | [ -f ~/.profile ] && . ~/.profile | ||
- | [ -f /etc/xprofile ] && . /etc/xprofile | ||
- | [ -f ~/.xprofile ] && . ~/.xprofile | ||
- | |||
- | if [ -f /etc/X11/xinit/xinitrc-common ]; then | ||
- | # fedora | ||
- | . /etc/X11/xinit/xinitrc-common | ||
- | if ! [ -z "$XDG_SESSION_COOKIE" ]; then | ||
- | CK_XINIT_SESSION= | ||
- | elif [ -x /usr/bin/ck-launch-session -a -z "$CK_XINIT_SESSION" ]; then | ||
- | CK_XINIT_SESSION="/usr/bin/ck-launch-session" | ||
- | fi | ||
- | exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\"" | ||
- | elif [ -x /etc/X11/xinit/Xsession ]; then | ||
- | # fedora | ||
- | exec /etc/X11/xinit/Xsession "$LXSESSION" | ||
- | elif [ -x /etc/X11/Xsession ]; then | ||
- | # mandriva, debian, ubuntu | ||
- | exec /etc/X11/Xsession "$LXSESSION" | ||
- | elif [ -x /etc/X11/xinit/xinitrc ]; then | ||
- | #suse | ||
- | export WINDOWMANAGER=$LXSESSION | ||
- | exec -l $SHELL -c /etc/X11/xinit/xinitrc | ||
- | else | ||
- | # unknown, user should custom /etc/lxdm/xinitrc self | ||
- | if [ -x /etc/lxdm/xinitrc ]; then | ||
- | . /etc/lxdm/xinitrc | ||
- | fi | ||
- | if ! [ -z "$XDG_SESSION_COOKIE" ]; then | ||
- | CK_XINIT_SESSION= | ||
- | elif [ -x /usr/bin/ck-launch-session ]; then | ||
- | CK_XINIT_SESSION="/usr/bin/ck-launch-session" | ||
- | fi | ||
- | exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\"" | ||
- | fi | ||
- | |||
- | </code> | ||
- | |||
- | |||
- | ==== /etc/lxdm/LoginReady ==== | ||
- | <code>#!/bin/sh | ||
- | # | ||
- | # Note: this is a sample and will not be run as is. | ||
- | </code> | ||
- | |||
- | ===== Running at Login Notes ===== | ||
- | |||
- | Note the only files that were modified/related to this fix is: | ||
- | * PostLogout | ||
- | * PreLogin | ||
- | |||
- | Other files are documented solely for the purpose of completeness. | ||
- | |||
- | Other improvements can possibly be made, but that's for another time and day... | ||
- | |||
- | --- //[[clee231@uic.edu|Chase Lee]] 2013/04/27 02:19// |