Scripts don't properly autostart

Recently, I switched to a dual monitor setup, and for the most part it’s been a smooth experience with getting everything configured. But I’ve noticed something odd with the way i3 handles scripts. Previously, I was using a script to load my monitor layout. This was just auto generated by arandr, but it doesn’t always properly work. The monitor layout will load, but it’s almost like the layout is flipped.

However if I load the essentially the same script using include, it works perfectly fine. Why is it that this way works and just executing a script doesn’t?

This is the code for the include file:

exec --no-startup-id xrandr --output DP-0 --off --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate normal --output eDP-1-1 --mode 1920x1080 --pos 0x1080 --rotate normal

This is the code for the script:

xrandr --output DP-0 --off --output DP-1 --off --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate normal --output eDP-1-1 --mode 1920x1080 --pos 0x1080 --rotate normal

Is that extra --output DP-1 --off in the second one intentional?

No, I actually didn’t notice that output. Like I said, I just let arandr generate the script for convenience.

I had a similar issue to this when I started using i3-wm. Mine was a laptop w/external monitor, different resolutions, so not sure either of these suggestions will apply to your use. In arandr it would show that the correct script applied, but my backgrounds were wrong, and overlapping on the displays. I also had the issue with the task tray showing on the wrong monitor.

First I commented out the line for feh in i3-wm config, and implemented setting my backgrounds in the display script. This corrected my backgrounds

#!/bin/sh
xrandr --output DP-1 --primary --mode 2560x1440 --pos 2048x0 --rotate normal --output eDP-1-2 --mode 2048x1152 --pos 0x0 --rotate normal 

# put backgrounds on correct monitor
sleep 2 && nitrogen --restore

NOTE

  • I switch resolutions with keyboard, if you do not, then you might try to increase the sleep on the feh line in i3-wm config
  • I only use nitrogen as I am more familiar with it, not because it is better, and I don’t know how to accomplish the same with feh

I then set the --primary setting in the layout script (this can be done manually or through the arandr gui) for the task tray to only show on one monitor

--output DP-1 --primary

and in the i3-wm config, I removed the comment for

tray_output primary

These helped with my expected/consistent layout for the monitors, again not sure if your use is the same issue.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.