I guess this is maybe one simple command but I haven't found it so far.
I'm running an Ubuntu-Server 16.04 LTS. Usually I have no Display connected to it, but since it runs an application which needs a GUI I have a cronjob set up to start the xfce4
GUI:
@reboot startx
And in ~/.config/autostart/myscript.sh
I'm starting the application.
This works all fine.
My problem is: Sometimes I have to change something in the configuration and I cannot do this via the terminal but have to use the GUI of the application.
But when I connect a display on the running Server it stays black.
After rebooting it recognizes the display again. But if I disconnect it now, xfce4
fails and ends the session (=> also terminates my application.)
So that until now I always have to go
- connect the display
- reboot the Server
- do stuff in the GUI
- disconnect the display
- reboot server again
This is ofcourse very stupid and the application shouldn't go down just because of a little config change so: Is there any way to make the server recognize the display without a reboot?
I found this answer and running
xrandr --query -display :0.0
actually says
Screen 0: minimum 8 x 8, current 1024 x 768, maximum 32767 x 32767
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 connected (normal left inverted right x axis y axis)
1920x1080 60.00 + 50.00 59.94
1920x1080i 60.00 50.00 59.94
1680x1050 59.88
1400x1050 59.95
1600x900 60.00
1280x1024 75.02 60.02
1440x900 59.90
1280x800 59.91
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 75.08 60.00
800x600 75.00 60.32
720x576 50.00
720x480 60.00 59.94
640x480 75.00 60.00 59.94
720x400 70.08
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
But the display is still saying
No signal
and goes black.
Update
As suggested by dessert I ran
xrandr --output HDMI2 --auto
This responds
Can't open display
-display
, it's either-d
or--display
, did you mean that? “Connected” is not the same as “enabled”, please try enabling the output withxrandr --output HDMI2 --auto
.-display :0.0
and it actually gave me information about the connected display so I guess it also works. I'll try the--output HDMI2 --auto
asap-d:0
without a space doesn't work inxrandr
, that's an unusual design decision. Whatevs, in general for a connected output the output ofxrandr
reads just e.g.HDMI2 connected (normal…
, an enabled one lists the currently used and available resolution modes, e.g.HDMI2 connected 1280x800+0+0 (normal…
with a list of resultions including the refresh rate below. Ping me if it helps and I'll extend it to an answer.