asset.onInitialize(function()
  local scale = openspace.dpiScaling()
  openspace.printInfo("Setting the DPI scaling factor to " .. tostring(scale))


  if openspace.modules.isLoaded("CefWebGui") then
    openspace.setPropertyValueSingle(
      "Modules.CefWebGui.GuiScale",
      openspace.getPropertyValue("Modules.CefWebGui.GuiScale") * scale
    )
  end

  local dashboards = openspace.getProperty("Dashboard.*.FontSize")
  for _, v in ipairs(dashboards) do
    openspace.setPropertyValueSingle(
      v,
      openspace.getPropertyValue(v) * scale
    )
  end

  local offset = openspace.getPropertyValue("Dashboard.StartPositionOffset")
  openspace.setPropertyValueSingle(
    "Dashboard.StartPositionOffset",
    { offset[1] * scale, offset[2] * scale }
  )
end)



asset.meta = {
  Name = "DPI Scaling",
  Version = "1.0",
  Description = [[Retrieves the DPI scaling from the operating system and applies it to a
    few selected places to make them scale better on "large resolution but small size"
    monitors]],
  Author = "OpenSpace Team",
  URL = "http://openspaceproject.com",
  License = "MIT license"
}
