Merge pull request #798 from sayansil/main

Use the existing util.cli module in contrib/optman
This commit is contained in:
tobi-wan-kenobi 2021-06-30 08:09:26 +02:00 committed by GitHub
commit 80663bdbc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,11 +5,10 @@ Requires the following packages:
"""
import subprocess
import core.module
import core.widget
import util.cli
class Module(core.module.Module):
def __init__(self, config, theme):
@ -20,13 +19,8 @@ class Module(core.module.Module):
return "GPU: {}".format(self.__gpumode)
def update(self):
cmd = ["optimus-manager", "--print-mode"]
output = (
subprocess.Popen(cmd, stdout=subprocess.PIPE)
.communicate()[0]
.decode("utf-8")
.lower()
)
cmd = "optimus-manager --print-mode"
output = util.cli.execute(cmd).strip()
if "intel" in output:
self.__gpumode = "Intel"