# coding=utf-8
""" create by pbc on 2016.05.17 for change ui .
"""


# 获取当前分辨率
import os


def getCurScreenResolution():
    cmd = "xrandr | grep \"^  .*x.*\*\" | sed  \"s/^\ \ \ //g\" | sed \"s/\ .*$//\""
    try:
        import os
        f = os.popen(cmd, "r")
        Resolution = f.readline().strip('\n')  # 去掉\n
        f.close()

    except Exception:
        raise Exception("getScreenResolution err")
    return Resolution

def getScreenWidth():
    return int(str(getCurScreenResolution()).split("x")[0])

def getScreenHeight():
    return int(str(getCurScreenResolution()).split("x")[1])


import common_run


def init_screen_with():

    __desktop_with = getScreenWidth()
    __desktop_height = getScreenHeight()

    common_run.SCREEN_WITH = __desktop_with
    common_run.SCREEN_HEIGHT = __desktop_height

def init_xserver_set():
    try:
        os.system("xset s off")
        os.system("xset -dpms")
    except:
        pass



