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
def check_primeoffload(): # only show the GPU in use with optimus, show both if prime render offload primeoffload = False try: primeoffload = exec_bash( "xrandr --listproviders | grep -o \"NVIDIA-0\"") return True except BashError: return False
def get_nvidia_gpu(nvidiagpuline, loop): for n in range(len(nvidiagpuline)): nvidiagpuinfo = nvidiagpuline[n] try: gputemp = exec_bash("nvidia-smi -q | awk '/GPU Current Temp/{print $5}'\ | sed 's/^/[/;s/$/°C]/'") nvidiagpuinfo += gputemp except BashError: pass return nvidiagpuinfo
def check_primeoffload(laptop, loop): # only show the GPU in use with optimus, show both if prime render offload primeoffload = False if args.debug and loop == 0: print("laptop: %s" % laptop) try: primeoffload = exec_bash("xrandr --listproviders | grep -o \"NVIDIA-0\"") return True except BashError: return False
def nvidia_gpu_temp(gpuline): nvidiagpu = "" try: gputemp = exec_bash( "nvidia-smi -q | awk '/GPU Current Temp/{print $5}'\ | sed 's/^/[/;s/$/°C]/'") for t in range(len(gpuline)): if "NVIDIA" in gpuline[t].split(): nvidiagpu = gpuline[t] + gputemp except BashError: pass print(nvidiagpu) return nvidiagpu
def get_amdgpurender(amdgpuline, intelgpuline, laptop): amdgpurenderlist = [] try: # amd GPUs for i in range(len(amdgpuline)): # assume DRI_PRIME=0 is the intel GPU if laptop and intelgpuline: i += 1 env_prime = "env DRI_PRIME=%s" % i amdgpurender = "GPU: " + \ exec_bash( "%s glxinfo | grep \"OpenGL renderer string:\" |\ sed 's/^.*: //;s/[(][^)]*[)]//g'" % env_prime) + ' ' if i != -1: amdgpurenderlist.append(amdgpurender) except BashError as e: print("ERROR: Could not run glxinfo [%s]" % str(e)) sys.exit(1) return amdgpurenderlist
except AttributeError: pass neofetchwin = "" if os.name == "nt": neofetchwin = os.popen("neofetch --noart").read() else: home = os.getenv('HOME') if os.path.isdir( "%s/.var/app/com.discordapp.Discord" % home) and not os.path.isfile( "/usr/bin/discord") and not os.path.isdir("/opt/Discord"): 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)) # use default neofetch output, ignoring user config baseinfo = exec_bash("neofetch --stdout --config none") # make lists cpu = "CPU:" cpuline = [] nvidiagpu = "GPU: NVIDIA" nvidiagpuline = [] amdgpu = "GPU: AMD" amdgpuline = [] intelgpu = "GPU: Intel"