I want to set up i3 automatically start on a specific one of my three screens (all connected to one Nvidia card). This has proved more difficult than expected.
My first choice was to just set that specific screen (HDMI) to be the main screen via GRUB options. However, it seems that is not possible with proprietary Nvidia drivers, which I need to use. So I gave up on that and only included it here as background. https://forums.developer.nvidia.com/t/can-i-choose-which-monitor-is-primary-as-in-gets-the-tty-login-for-gt710/197021
My second choice is to just
startxautomatically at boot and have it start i3 on the screen of my choice. I have already configured X screens so that I can address my displays like:0.0,0.1,0.2.At first I tried to get i3 on the display of my choice by
DISPLAY=:0.2 startx, but obviously that doesn't work because the displays have not yet been assigned asXhas not yet started.I thought I would try specifying the display by modifying the script that invokes
i3, which I expected to be/etc/X11/xinit/xinitrc. However I see nothing about i3 there, or in any of the other places I expected to find it such as/etc/profileor/etc/X11/Xsession. Grepping inside/etc/X11and my home folder forexec i3yielded nothing. So where is i3 actually being invoked when I runstartx?Next, I tried
DISPLAY=:0.2 sudo xinit i3. That opens up i3 on the main display, but with with an xterm window for the i3 process. If I quit this window, i3 closes. So this it wastes screen space on a window that I won't interact with.
So my questions are:
- How do I start
i3with a command and have it open with the same result as when I runstartx? - Where can I find the command which
startxuses to invoke i3?
Solution (but not answer)
I get the desired effect by creating ~/.xinitrc with DISPLAY=0.2 exec i3. However I am still curious how i3 was being invoked before. I would rather have made this change there. And why does i3 need to be started with exec instead of xinit?
startxand look at the files it references. See if /usr/bin/x-session-manager exists and if so does it link to /etc/alternatives. Typically you have asession managerstarted bystartxas the client and it will start yourwindow manager(i3 in your case).exec i3command in any of the usual suspects./etc/X11/xinit/xinitrcis looking a var calledWINDOWMANAGERwhich sets it, and it is being set via/etc/profile.d/profile.sh.