Hey, I’ve been using endeavouros with qtile for a few months and have had a great experience! recently, I rotated my left display to a portrait-style aspect ratio, but every time I reboot, it resets back to how it used to be. I used both xrandr and arandr to set my display settings, but nothing else.
Something else that I want to note is that I’m dual booting linux and windows with separate drives (I rarely use the latter, but I keep it strictly for gaming). I think the issue may lie here because my primary display through my bios isn’t the primary display through xrandr in my linux drive. I’m unsure how I could change that, though, because I didn’t see any options to modify it from the bios settings.
I’d really appreciate any help or guidance to overcome this annoying issue!
As a bonus question, I’m also wondering if anyone has experience changing the tiling layout depending on the different display. I’d want my left monitor to tile horizontally first (top and bottom), but that’s not my main concern right now.
The display configurations set by xrandr and arandr will last for that session only. What you need here is some basic automation – in other words, configure your system to automatically execute those commands every time you log into your graphical session, and how you do this depends on your particular environment. If you use a display manager like lightdm, you can write a script, make it executable, and then add that script to your lightdm configuration file under: session-setup-script
Now, I’m going to share with you some of my tricks to configure multiple monitors on a window manager.
My current set up automates display configurations every time I start a display server. I’m using i3wm, not qtile, so the details might be a little bit different. However, the main idea is the same. Here is how I do it.
i3wm provides a mechanism to extend the main configuration file using an include directive, so I used that to my advantage. For example, if I add the following line to my main i3 configuration file:
i3 will include the contents of the file ~/.config/i3/additional_config in my main i3 config file (much like the include directive in the C programming language) when i3 is launched.
On my system, the file ~/.config/i3/additional_config is actually a symbolic link to different configuration files, each providing different i3 configurations rules for a particular display combination (laptop screen only, laptop screen + HDMI, laptop screen + display port, etc). The reason I have it set up this way is because I have different keybindings, workspace assignments, and layout configurations depending on the number of displays that are connected to my system.
Currently, I have three sets of additional configurations (single display, double display, and triple display). Single display means no monitors are connected (just using the laptop display). Double display means one external monitor is connected, and so on.
To automate this, I just have to write a simple shell script to make the symlink ~/.config/i3/additional_config point to the correct configuration file every time I start a display server. That way, i3 will add the correct configurations depending on how many monitors I have connected to my laptop.
# Display names
# Configuration files
# Display positions relative to laptop screen
if [ -L "$1" ]
case "$state" in
xrandr --output "$LAPTOP" --auto --output "$HDMI" --off --output "$DISPLAY_PORT" --off
# $TOP must be set before this function is called
xrandr --output "$TOP" --auto --above "$LAPTOP"
xrandr --output "$TOP_LEFT" --auto --above "$LAPTOP" --output "$TOP_RIGHT" --auto --right-of "$TOP_LEFT"
# First, determine the state of each output device
display_port_state=$(xrandr | grep "^$DISPLAY_PORT" | cut -d " " -f 2)
hdmi_state=$(xrandr | grep "^$HDMI" | cut -d " " -f 2)
# Process the states
if [ "$display_port_state" = "connected" ] && [ "$hdmi_state" = "connected" ]
# Both display ports and HDMI are connected (triple display)
elif [ "$display_port_state" = "connected" ] && [ "$hdmi_state" = "disconnected" ]
# Only display port is connected (double display)
# Must use display port as TOP
elif [ "$display_port_state" = "disconnected" ] && [ "$hdmi_state" = "connected" ]
# Only hdmi is connected (double display)
# Must use hdmi as TOP
# No external monitors connected (single display)
# Set the symlink to point to the correct file.
ln -s "$config_file" "$SYMLINK"
The actual script is a bit more complicated than this, but that’s the gist of it. Since I’m not using a display manager, I just launch this script from my .xinitrc and it will run every time I start an X session.
yup you’re a legend lol… the script worked!! this was my first time doing something like this, thanks a lot! I’m having a slight issue, though:
the script works as expected in the greeter (login) screen, but there’s an issue with the display positioning once I’m signed in. I’m assuming I need the script to run again once my session is started, but it isn’t working for me
the script should look something like this:
xrandr --output DVI-D-0 --off --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate left --output DP-0 --primary --mode 1920x1080 --pos 1080x420 --rotate normal --output DP-1 --off
but instead the positioning looks like this when my session starts: