Skip to content

Commit e07dbdc

Browse files
authored
Changed to new style of envycontrol -q
New style of the envycontrol -q output was causing a problem that script wasn't able to indetify current GPU-mode.
1 parent ae130b0 commit e07dbdc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

main/envycontrol_qt.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import sys
1+
import sys, os, re, subprocess
22
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout, QPushButton, QLineEdit, QInputDialog, QSystemTrayIcon, QMenu
3-
import subprocess
43
from PyQt5.QtGui import QIcon
54
from PyQt5 import QtGui
6-
import os
5+
76
current_dir = os.path.dirname(os.path.abspath(__file__))
87
isHybrid = True
98

109
class EnvyControl(QWidget):
1110

12-
1311
def start_status(self):
14-
result = subprocess.check_output(['envycontrol', '-q'])
15-
sep = ': '
16-
status = result.strip().decode()
17-
status = status.split(sep, 1)[1]
18-
return status
12+
status_output = subprocess.check_output(['envycontrol', '-q']).decode().strip()
13+
keywords = ["hybrid", "integrated", "nvidia"]
14+
for keyword in keywords:
15+
if re.search(keyword, status_output, re.IGNORECASE):
16+
return keyword
17+
return "envycontrol -q output style was changed"
18+
1919

2020
def quit(self):
2121
sys.exit()

0 commit comments

Comments
 (0)