Created
February 23, 2024 20:43
-
-
Save axlroden/ae9470255202fb6f14c5276a1944f731 to your computer and use it in GitHub Desktop.
Kodi always on my 4K TV instead of my 1440p monitor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<advancedsettings> | |
<videoscreen> | |
<monitor>Generic PnP Monitor #1</monitor> | |
</videoscreen> | |
</advancedsettings> | |
<!-- place this in "C:\Users\YOURUSERNAME\AppData\Roaming\Kodi\userdata --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Create a shortcut to this file, shortcut like this does not generate popup: | |
# mshta vbscript:Execute("CreateObject(""WScript.Shell"").Run ""powershell -ExecutionPolicy Bypass & 'C:\kodi.ps1'"", 0:close") | |
# Get the list of monitors | |
$monitors = Get-WmiObject -Namespace root\cimv2 -Class Win32_DesktopMonitor | |
# Filter the 4K monitor | |
$fourKMonitor = $monitors | Where-Object { $_.ScreenWidth -eq 3840 -and $_.ScreenHeight -eq 2160 } | |
# Extract the monitor number | |
$monitorNumber = $fourKMonitor.DeviceID -replace '\D+(\d+)', '$1' | |
# Update the advancedsettings.xml file, replace your username | |
$advancedSettingsFile = "C:\Users\YOURUSERNAME\AppData\Roaming\Kodi\userdata\advancedsettings.xml" | |
$xml = [xml](Get-Content $advancedSettingsFile) | |
$xml.advancedsettings.videoscreen.monitor = "Generic PnP Monitor #$monitorNumber" | |
$xml.Save($advancedSettingsFile) | |
# Launch Kodi | |
Start-Process -FilePath "C:\Program Files (x86)\Kodi\kodi.exe" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment