LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How can i “spy” on my second dual monitor output from the main monitor screen? (https://www.linuxquestions.org/questions/linux-software-2/how-can-i-%93spy%94-on-my-second-dual-monitor-output-from-the-main-monitor-screen-4175612070/)

1branchonthevine 08-16-2017 01:50 PM

How can i “spy” on my second dual monitor output from the main monitor screen?
 
I have a dual monitor laptop setup, but have no way to view the second monitor screen, unless i leave and go into a different area of the building, so how can i view the contents of the second monitor output on my main primary screen? Preferably a software method, without buying extra hardware like a kvm/splitter/extra monitor/etc.

Ideally, i would like a live desktop background of my second monitor always playing as the default desktop image, so if i want to see the second screen, i could just minimize my windows and see it live. But, I could see using a widget, or an application like VNC, VLC, but i presume this would put alot of overhead on my already busy CPU, so i'd rather not. Is there a more direct tap method, i.e. some way i can just route the actual raw monitor feed to a tandem/slave output into something? This way no capture/compression/streaming/etc is going on, it's just a direct monitor tap, kind of like screen mirroring tap, but without needing 3 monitors (one main, and two mirrored).

Thanks!

1branchonthevine 08-16-2017 01:56 PM

Is there a quick soft-switch method, like hitting a few keys to momentarily swap screens, or something like ctl alt F# to switch terminal sessions, or some other workspace switcher way to link monitors to the built in linux workspaces?

AwesomeMachine 08-16-2017 04:54 PM

Hi 1branchonthevine,

Welcome to LQ!

You can use gnome-control-center to set up your displays, but it would a bit of a pain to do it often. I'm interested in why you would connect a second monitor that you can't view.

IsaacKuo 08-16-2017 05:26 PM

If you just want a peek that doesn't cost any CPU otherwise, then you could use a screenshot utility. The exact details would depend on your favorite image viewer utility and the desktop environment/WM you use.

But basically, my strategy would be:

1) Set up a panel launcher icon for a custom script (~/peeker.sh)

2) Install some sort of screenshot utility if necessary, such as xfce4-screenshooter, and an image viewer, like geeqie, if necessary

3) write the script peeker.sh to take a screenshot and display it in a window. Something like:

Code:

#!/bin/sh
rm -v /tmp/Screenshot_????-??-??_??-??-??.png
xfce4-screenshooter -f -o geeqie

That way, when I click on that panel launcher icon, it will run the script; it takes a full screenshot and saves it to /tmp for output to the image viewer.

When the script isn't running, this consumes no CPU at all.

haertig 08-21-2017 07:21 PM

Unless you've gone out of your way to change it, the default behavior should be for your task bar to list all open windows, regardless of which monitor they are displaying on. So you should easily be able to figure out what is RUNNING on the hidden display, but this wouldn't tell you what it is currently DISPLAYING.

You might try changing desktop settings temporarily. If you turn off dual displays then I would assume that all open windows would transfer to your main display (I haven't tested that, but that's what I assume would happen). When you're done inspecting those previously hidden windows, turn dual displays back on. But (still assuming here) I'd think that all your windows would still be clustered on your main screen, I doubt they'd know to automatically move back to that second monitor that you just re-enabled.

What would be ideal, is if you could define a workspace/screen binding. i.e., "Workspace #1 displays on Screen #1" and "Workspace #2 displays on Screen #2". Then maybe you could use the built-in workspace switcher to move between the two by changing which screen is bound to which workspace. I searched for something like this about a year ago, but did not find it. Things may have changed since then however.

I would like something like this too. With my dual monitor setup, I don't often use the second screen (it is in vertical orientation, and I mostly use that for software writing). So I leave that second monitor turned off. Every now and then when I open a new window from my main screen, for some unknown reason it decides to open over on the second screen. Yeah, the one that is turned off. I have learned to look down at my task bar and if the window I just tried to open is listed there, but I don't see it on my main screen, I know to turn on the second screen and manually drag to errant window back to where I want it to display. Most everything does the sensible thing and opens on my main screen, but there are a few idiot programs that are kind of dumb. The best example of that for my system is "Kindle for PC" (the eBook reader) running under Wine. It just loves that second (turned off) screen for some reason. Also, after a reboot, I'll sometimes click on the Start Menu icon and the popup opens on the second screen. Now THAT is really annoying. Luckily, I seldom reboot, so it's not a terribly big deal. Dual monitor setup is not perfect under Linux. But it's not great under Windows either. There's always some psycho window that thinks the grass is greener over on the "other" monitor.

estabroo 08-22-2017 08:51 AM

You might be able to use x11vnc to do it, give it the -display argument of the second display (probably something like :0.1) and then run a vnc viewer program and connect with that vnc server. This should let you see it and interact with it if you want.

IsaacKuo 08-22-2017 10:43 AM

Quote:

Originally Posted by estabroo (Post 5750918)
You might be able to use x11vnc to do it, give it the -display argument of the second display (probably something like :0.1) and then run a vnc viewer program and connect with that vnc server. This should let you see it and interact with it if you want.

This is actually just a single display spanning multiple monitors. So this would...well it would not work right. However, something similar may work. I'm going to try it right now...

Okay, this will work using x11vnc server and xtightvnc client. On a Debian based distribution, install these with:

Code:

apt-get install x11vnc xtightvncviewer
x11vnc is the server which lets you view/control an existing x11 display. (Contrast with vnc servers which create their own independent X sessions.)

xtightvncviewer is one of several possible vnc clients. They all have subtle differences, so the precise one you use matters. I think xtightvncviewer may be the only one which displays the server's mouse pointer.

To use this, type in the following commands:

Code:

x11vnc -nowf -clip 1280x1024+1280+0 &
vncviewer -viewonly 127.0.0.1

You want to clip the x11vnc server to just the secondary screen. The first two numbers are the size of the secondary screen. The next two numbers are the coordinates of the upper left corner, relative to the overall virtual screen space.

It is very important that you use "-viewonly" mode in vncviewer. Otherwise...well, it won't work right. It'll try to send mouse/keyboard events and ... bleh.

Once you get this working, you can create a shell script/icon to activate this. Make it something like this:

Code:

#!/bin/sh
x11vnc -nowf -clip 1280x1024+1280+0 &
vncviewer -viewonly 127.0.0.1

Don't forget to "chmod 755 myscript.sh" to make it executable. Then, set up a launcher icon for it with your GUI desktop environment. This will let you click on the launcher at any time to "remotely" view your second screen; close it by closing the viewer window.

1branchonthevine 08-25-2017 01:40 PM

haertig... Binding workspaces to monitors would be perfect! I could just click a workspace on my main screen, and instead of it being a new blank space for the main screen, it could be assigned/binded to the second monitor, that way I can see everything going on in that workspace/monitor. Perfect! But, still no luck finding this on google forum searches... let me know if you happen to stumble on it later!

Although I did find this post, but it seems to use a different window manager "i3?" I'm not so sure this is even quite what i'm looking to do:

----------------------------------------------------
SIMILAR QUESTION:
Assign workspaces on i3 to multiple displays

I've switched on using i3 on my Linux laptop. I'm usually using only the laptop's internal monitor (display eDP1), but when I'm at work I tend to connect a secondary monitor to my computer's HDMI port (display HDMI2). So far, I've made this work fine by adding these commands to my i3 config file:

# use workspaces on different monitors
workspace "1: P1" output eDP1
workspace "2: P2" output eDP1
workspace "3: P3" output eDP1
workspace "4: P4" output eDP1
workspace "5: P5" output eDP1
workspace "6: S1" output HDMI2
workspace "7: S2" output HDMI2
workspace "8: S3" output HDMI2
workspace "9: S4" output HDMI2
workspace "10: S5" output HDMI2

# add HDMI monitor when connected
exec --no-startup-id xrandr --output HDMI2 --right-of eDP1
bindsym $mod+m exec --no-startup-id xrandr --output HDMI2 --auto --right-of eDP1

In other words, when I connect my HDMI display I just press Mod+M to get i3 to detect it, place it right of my primary display, and delegate 5 named workspaces (6-10) to it.

Here's the problem: At home, I have another monitor that I can connect with VGA (display DP2). I can run the xrandr command above to place this display to the right of my primary display as well, but I can't get the workspaces to be assigned to this display by default, unless I replace the rules I already have for my HDMI monitor. I would like both these workspaces to work the same no matter which monitor I use, so this is not an option.

TL;DR Is there a way to assign workspaces to two different displays, depending on which display is connected (assuming they never will be connected at the same time)?

----------------------------------------------------
REPLY:
You can't assign multiple outputs to single workspace, see: https://github.com/i3/i3/issues/555

So the only way is to change i3 config dynamically. You could assign to hotkey script that will be doing 2 things: changing monitor outputs with xrandr and moving workspaces with i3-msg:

xrandr --output DP2 --auto --right-of eDP1
i3-msg "workspace 6, move workspace to output DP2"
...
i3-msg "workspace 10, move workspace to output DP2"

With above script you will move 6-10 workspaces to DP2 and end up staying on workspace 10.
----------------------------------------------------


Quote:

Originally Posted by haertig (Post 5750752)
Unless you've gone out of your way to change it, the default behavior should be for your task bar to list all open windows, regardless of which monitor they are displaying on. So you should easily be able to figure out what is RUNNING on the hidden display, but this wouldn't tell you what it is currently DISPLAYING.

You might try changing desktop settings temporarily. If you turn off dual displays then I would assume that all open windows would transfer to your main display (I haven't tested that, but that's what I assume would happen). When you're done inspecting those previously hidden windows, turn dual displays back on. But (still assuming here) I'd think that all your windows would still be clustered on your main screen, I doubt they'd know to automatically move back to that second monitor that you just re-enabled.

What would be ideal, is if you could define a workspace/screen binding. i.e., "Workspace #1 displays on Screen #1" and "Workspace #2 displays on Screen #2". Then maybe you could use the built-in workspace switcher to move between the two by changing which screen is bound to which workspace. I searched for something like this about a year ago, but did not find it. Things may have changed since then however.

I would like something like this too. With my dual monitor setup, I don't often use the second screen (it is in vertical orientation, and I mostly use that for software writing). So I leave that second monitor turned off. Every now and then when I open a new window from my main screen, for some unknown reason it decides to open over on the second screen. Yeah, the one that is turned off. I have learned to look down at my task bar and if the window I just tried to open is listed there, but I don't see it on my main screen, I know to turn on the second screen and manually drag to errant window back to where I want it to display. Most everything does the sensible thing and opens on my main screen, but there are a few idiot programs that are kind of dumb. The best example of that for my system is "Kindle for PC" (the eBook reader) running under Wine. It just loves that second (turned off) screen for some reason. Also, after a reboot, I'll sometimes click on the Start Menu icon and the popup opens on the second screen. Now THAT is really annoying. Luckily, I seldom reboot, so it's not a terribly big deal. Dual monitor setup is not perfect under Linux. But it's not great under Windows either. There's always some psycho window that thinks the grass is greener over on the "other" monitor.



All times are GMT -5. The time now is 04:56 AM.