LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I force applications to open in a specified display in Arch Linux? (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-force-applications-to-open-in-a-specified-display-in-arch-linux-4175554198/)

kentkentkent 09-22-2015 12:45 PM

How can I force applications to open in a specified display in Arch Linux?
 
Hello LinuxQuestions!

I have two displays connected to my desktop PC, my computer monitor and my TV. There are a few programs I'd like to open on my TV rather than my desktop monitor.

How can I do so?

I'm thinking of something on the lines of something I'd put before the command to run the program, so I use it in some config files for programs that start other programs.

I'm using GNOME on Arch Linux.

pan64 09-23-2015 06:07 AM

I think that is the variable DISPLAY or option --display good for.

kentkentkent 10-02-2015 01:39 PM

Alright! So for example, would I type something like this?
Code:

[user@localhost ~]$ command DISPLAY=:1
From what I understand
Code:

DISPLAY=:0
is my first monitor, so I assume my second monitor would be "1". No matter what number I replace "0" with, the application still opens in my default display. How would I set the variable for my second monitor?

273 10-02-2015 03:54 PM

On my system (XFCE on NVIDIA with separate X sessions) the displays are :0.0 and :0.1 and I can, for example, run Firefox on the first by running:
Code:

DISPLAY=:0.0 firefox
I think that's fairly standard.

kentkentkent 10-02-2015 03:56 PM

Thanks! Gave that a try and got

Code:

Invalid MIT-MAGIC-COOKIE-1 key
** (gedit:9719): WARNING **: Could not open X display
Invalid MIT-MAGIC-COOKIE-1 keyUnable to init server: Verbindung ist gescheitert:Verbindungsaufbau abgelehnt

(gedit:9719): Gtk-WARNING **: cannot open display: :0.1

I feel like I'm getting somewhere, but I'm not quite there yet.

Did you set it up to run separate X sessions, or is this the default for most desktop environments?

273 10-02-2015 03:59 PM

I have seen something similar but, sorry, can't recall whether it was with VNC or plain X11 or how I fixed it (I mess around a lot).

kentkentkent 10-02-2015 04:09 PM

Yeah, this error goes for anything except

Code:

DISPLAY=:1
It just opens on whatever monitor I have my command line window on.

(Previously I said DISPLAY:1 didn't work, my bad)

273 10-02-2015 04:25 PM

Quote:

Originally Posted by kentkentkent (Post 5429028)
Yeah, this error goes for anything except

Code:

DISPLAY=:1
It just opens on whatever monitor I have my command line window on.

(Previously I said DISPLAY:1 didn't work, my bad)

So 1.0 and 1.1 don't work either?
Which graphics card are you using and how are you achieving dual monitor? I have a sneaking suspicion that you won't be able to do what you want via DISPLAY though an easy check come to mind and that is to open a terminal in the display you want to open the application on and type:
Code:

echo $DISPLAY
If both displays show the same then I'm not sure how you can do what you want though, I suppose, it might be possible to do it via the window manager or use window geometry?

kentkentkent 10-02-2015 04:32 PM

Quote:

So 1.0 and 1.1 don't work either?
Sadly no.
Quote:

Which graphics card are you using and how are you achieving dual monitor?
I'm using an NVIDIA Geforce GT 630. All I did was buy an HDMI adapter for my graphics card, then I connected an HDMI cable from my PC to my TV. Gnome took care of the rest.

By entering
Code:

echo $DISPLAY
I get
Code:

:1
on both monitors.

273 10-02-2015 04:36 PM

Then you can't do what you want using DISPLAY. I use the proprietary NVIDIA drivers and have "separate X sessions" which means I can't move windows between the two monitors but can refer to the displays separately. All dual display settings come with their own advantages, issues and cludges though so you might just need to research things and/or play around.

kentkentkent 10-02-2015 04:51 PM

Quote:

I use the proprietary NVIDIA drivers and have "separate X sessions" which means I can't move windows between the two monitors but can refer to the displays separately.
I think I might as well try that out.

How do you access the NVIDIA settings? I did a
Code:

pacman -Qs nvidia
but I'm not finding any sort of application I can run.

kentkentkent 10-02-2015 04:54 PM

I know in Retroarch there's a "monitor index" option in the video settings. Setting it to "2" makes it run only on my second monitor.

273 10-02-2015 05:02 PM

I'm afraid I don't know how the NVIDIA drivers are installed in Arch or whether you have the proprietary drivers or the open source ones. If you have the proprietary drivers then you ought to have nvidia-settings installed -- if it needs to modify xorg.conf it has to be run with root privileges but can otherwise be run as the logged in user.

kentkentkent 10-03-2015 02:14 AM

Awesome. My other monitor no longer displays the same wallpaper and shows an "x" as my cursor. That tells me it worked.

Unfortunately, nothing works except for DISPLAY=:1 (still). I don't know how to open a terminal on my new display, and I can't drag anything over to my second display.

For example, entering

Code:

DISPLAY=1:0 gedit
gives me

Code:

** (gedit:1973): WARNING **: Could not open X display
Unable to init server: Verbindung ist gescheitert:Verbindungsaufbau abgelehnt

(gedit:1973): Gtk-WARNING **: cannot open display: 1:0

which is really odd because nvidia-settings recognizes DISPLAY=1.0 and DISPLAY=1.1.

I really want to do a

Code:

echo $DISPLAY
but I can't do anything but move the cursor on my second monitor.

273 10-03-2015 03:28 AM

Remember I was using :0.0 and :0.1 myself so to you that would likely be :1.0 and :1.1. It may also be worth finding a window manager or DE which can use both monitors to use for testing purposes if nothing else. nvidia-settings may also give you a clue as to which display is named what.


All times are GMT -5. The time now is 07:37 PM.