-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem_control.py
More file actions
49 lines (39 loc) Β· 1.71 KB
/
system_control.py
File metadata and controls
49 lines (39 loc) Β· 1.71 KB
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
40
41
42
43
44
45
46
47
48
49
import os
import platform
import pyautogui
def execute_command(command):
system = platform.system()
if "lumos" in command or "increase brightness" in command:
if system == "Windows":
os.system("powershell (Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightnessMethods).WmiSetBrightness(1,100)")
elif system == "Linux":
os.system("xrandr --output eDP-1 --brightness 1.0") # Adjust eDP-1 if needed
print("π‘ Brightness increased.")
elif "nox" in command or "decrease brightness" in command:
if system == "Windows":
os.system("powershell (Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightnessMethods).WmiSetBrightness(1,50)")
elif system == "Linux":
os.system("xrandr --output eDP-1 --brightness 0.5")
print("π Brightness decreased.")
elif "open camera" in command:
os.system("start microsoft.windows.camera:")
print("πΈ Camera opened.")
elif "shutdown" in command:
os.system("shutdown /s /t 10") # 10-second delay
print("β οΈ Shutting down in 10 seconds...")
elif "cancel shutdown" in command:
os.system("shutdown /a")
print("β Shutdown canceled.")
elif "volume up" in command:
for _ in range(3): # Increase volume step-wise
pyautogui.press("volumeup")
print("π Volume increased.")
elif "volume down" in command:
for _ in range(3): # Decrease volume step-wise
pyautogui.press("volumedown")
print("π Volume decreased.")
elif "mute" in command:
pyautogui.press("volumemute")
print("π Muted.")
else:
print("π€· Command not recognized.")