You can save it as *.py file and install as an add-on. This add-on will check the screen resolution (if you are using Windows) and change scale after a file is loaded (basically on startup)
bl_info = {
"name": "UI scale",
"version": (1, 0),
"blender": (2, 80, 0),
"location": "",
"description": "",
"warning": "",
"doc_url": "",
"category": "Interface",
}
import bpy
import ctypes
from bpy.app.handlers import persistent
@persistent
def load_handler(dummy):
user32 = ctypes.windll.user32
screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
prefs = bpy.context.preferences.view
# fill in your resolution here:
if screensize == (1920,1080):
# and scale that you want:
prefs.ui_scale = 1.2
else:
# and default scale:
prefs.ui_scale = 1.0
def register():
bpy.app.handlers.load_post.append(load_handler)
# uncomment to go nuts and check on every change
# bpy.app.handlers.depsgraph_update_post.append(load_handler)
def unregister():
bpy.app.handlers.load_post.remove(load_handler)
# uncomment to go nuts and check on every change
# bpy.app.handlers.depsgraph_update_post.remove(load_handler)
if __name__ == "__main__":
register()