-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackend.cpp
More file actions
39 lines (28 loc) · 790 Bytes
/
Copy pathbackend.cpp
File metadata and controls
39 lines (28 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "backend.h"
#include <QProcess>
QString Backend::currentMode()
{
QProcess process;
process.start("supergfxctl", {"--get"});
process.waitForFinished();
QString output = process.readAllStandardOutput();
if (output.contains("Integrated", Qt::CaseInsensitive))
return "Integrated";
if (output.contains("Hybrid", Qt::CaseInsensitive))
return "Hybrid";
if (output.contains("AsusMuxDgpu", Qt::CaseInsensitive))
return "Ultimate";
return "Unknown";
}
bool Backend::switchMode(const QString& mode)
{
QProcess process;
process.start(
"pkexec",
QStringList()
<< "supergfxctl"
<< "-m"
<< mode);
process.waitForFinished(-1);
return process.exitCode() == 0;
}