예제 #1
0
def XDG_Symlink(home):
    try:
        print("Symlinking XDG_RUNTIME_DIR path for Flatpak Discord.")
        exec_bash(
            "cd %s/.var && ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-0 "
            % home)
    except BashError as e:
        print("Could not symlink XDG_RUNTIME_DIR Error: %s" % str(e))
        return
예제 #2
0
 def check_primeoffload(self):
     # only show the GPU in use with optimus, show both if prime render offload
     self.primeoffload = False
     try:
         self.primeoffload = exec_bash(
             'xrandr --listproviders | grep -o "NVIDIA-0"')
         return True
     except BashError:
         return False
예제 #3
0
    def get_amdgpurender(self, gpu_list: List[GpuType], laptop: bool) -> str:
        try:
            for i in range(len(gpu_list)):
                # assume DRI_PRIME=0 is the intel GPU
                if laptop and "intel" == gpu_list[i].vendor.lower():
                    i += 1
                if (laptop and "amd" == gpu_list[i].vendor.lower()
                        and gpu_list[i].model != self.model):
                    i += 1

                env_prime = "DRI_PRIME=%s" % i
                return exec_bash(
                    "%s glxinfo | grep \"OpenGL renderer string:\" |sed 's/^.*: //;s/[(][^)]*[)]//g'"
                    % env_prime)
        except BashError as e:
            print("ERROR: Could not run glxinfo [%s]" % str(e))
            sys.exit(1)
예제 #4
0
 def get_temp(self):
     if self.os == "windows":
         raise NotImplementedError(
             "Temperature report for Nvidia GPU's is not supported on Windows yet."
         )
     elif self.os == "macos":
         raise NotImplementedError(
             "Temperature report for Nvidia GPU's is not supported on MacOS yet."
         )
     elif self.os == "linux":
         try:
             return exec_bash(
                 "nvidia-smi -q | awk '/GPU Current Temp/{print $5}' | sed 's/^/[/;s/$/°C]/'"
             )
         except BashError:
             pass
     else:
         raise NotImplementedError("Unknown OS, no GPU temperature report.")
예제 #5
0
def get_mobo(os: str, line: List, value: str, key: str):
    if (os == "linux"):
        line.append(exec_bash("cat /sys/devices/virtual/dmi/id/board_vendor"))
    else:
        line.append(value[value.find(key) + len(key) + 1:])