Linux mint has a few annoyances when using dual monitors. First fixing the log in screen. By default, it uses the same resolution as the primary monitor in the secondary screen. My secondary monitor is much larger so it doesn't display correctly. It's only cosmentic but it annoys me.
Create or append the file /etc/lightdm/lightdm.conf.d/70-linuxmint.conf
so that it has the lines
[SeatDefaults]
user-session=cinnamon
display-setup-script=/usr/bin/lightdmxrandr.sh
With both monitors connected run xrandr -q
and note the name and resolutions of the connected monitors. Mine are called eDP-1-1
(the laptop) and DP-0
(my 2nd monitor).
Create the file /usr/bin/lightdmxrandr.sh
#! /bin/sh
if xrandr | grep -q "DP-0 connected"; then
logger -s "Dual monitor setup"
xrandr --output eDP-1-1 --mode 1920x1080 --primary --output DP-0 --mode 2560x1440 --right-of eDP-1-1
else
logger -s "Single monitor setup"
xrandr --output eDP-1-1 --mode 1920x1080
fi
You'll need to alter this as needed. Here I've made eDP-1-1 my primary monitor and I've set the second monitor to be to the right of my primary monitor.
The logger -s print to stderr and the system log. It's not really needed but help with debugging. You can read the messages with journalctl
You need to make this an executatble file with sudo chmod o+x /usr/bin/lightdmxrandr.sh
. You run this script now to test that it's working correctly.
I have my start menu on the second monitor, and there is a bug that means if I unplug the monitor the panel does't move back to the laptop screen. To fix this I have a script. It's written in fish but could easily be changed to bash
function reset_panel
set screens (xrandr | grep -c ' connected ')
echo "found $screens displays"
if [ "$screens" = 1 ]; then
gsettings set org.cinnamon panels-enabled "['1:0:bottom']"
else
gsettings set org.cinnamon panels-enabled "['1:1:bottom']"
end
end
Ctrl Alt T
will bring up a terminal to so I can run this. TODO automate this!