2018-01-16, 10:42
HI,
My Linux install is based on wayland and my set-up includes one DVI monitor and one HDMI TV. I know wayland support will come in Kodi 18 but in the mean time I was looking for tricks to workaround the black screen issues in a convenient manner.
The main issue was when my TV was switched off, Kodi full screen window, become a black screen on my main monitor. Restarting Kodi is needed, but when setting again the right monitor in Kodi led to a black screen. Forcing me to edit in the settings file the correct screen identifier then start kodi.
I cannot prevent the black screen, it seems there are tricks with the EDID, but I didn't tried them as I see a lot of threads that have Xorg and I don't. Maybe I'm confusing things. Anyway I found a way to start Kodi on the correct screen wchich is my TV.
To explain a bit this command : Wayland offers a compatibility mode for X based application, the screens are identified as XWAYLAND#. XWAYLAND0 is the main monitor, this number is stable in my experience. Then there's XWAYLAND# (starting form 1) which represents the TV, and this number increases each time the TV is switched on and off again. By looking at the kodi logs and the Kodi bin, I found kodi-xrandr, which I found useful to detect current screen identifiers. With some shell scripting I found a way to replace the old identifier by the correct one. I know this isn't a perfect solution, but it allows to start kodi without the manual gymnastic which is pretty handy.
Setting the DISPLAY=:0 also helps me to run this command while on ssh shell e.g. from my mobile phone.
What do you think of that workaround ?
My Linux install is based on wayland and my set-up includes one DVI monitor and one HDMI TV. I know wayland support will come in Kodi 18 but in the mean time I was looking for tricks to workaround the black screen issues in a convenient manner.
The main issue was when my TV was switched off, Kodi full screen window, become a black screen on my main monitor. Restarting Kodi is needed, but when setting again the right monitor in Kodi led to a black screen. Forcing me to edit in the settings file the correct screen identifier then start kodi.
I cannot prevent the black screen, it seems there are tricks with the EDID, but I didn't tried them as I see a lot of threads that have Xorg and I don't. Maybe I'm confusing things. Anyway I found a way to start Kodi on the correct screen wchich is my TV.
Code:
env DISPLAY=:0 sed -i -E "s/<monitor[^>]*>.*<\/monitor>/<monitor>$(env DISPLAY=:0 /usr/lib/kodi/kodi-xrandr --current | grep -o 'XWAYLAND[1-9][0-9]\?')<\/monitor>/g" $HOME/.kodi/userdata/guisettings.xml && env DISPLAY=:0 nohup kodi &
To explain a bit this command : Wayland offers a compatibility mode for X based application, the screens are identified as XWAYLAND#. XWAYLAND0 is the main monitor, this number is stable in my experience. Then there's XWAYLAND# (starting form 1) which represents the TV, and this number increases each time the TV is switched on and off again. By looking at the kodi logs and the Kodi bin, I found kodi-xrandr, which I found useful to detect current screen identifiers. With some shell scripting I found a way to replace the old identifier by the correct one. I know this isn't a perfect solution, but it allows to start kodi without the manual gymnastic which is pretty handy.
Setting the DISPLAY=:0 also helps me to run this command while on ssh shell e.g. from my mobile phone.
What do you think of that workaround ?