-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
49 lines (39 loc) · 1.18 KB
/
settings.py
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 subprocess
import psutil
import shutil
print("welcome to linux wifi and battery settings")
def connecttowifi():
wifies = subprocess.check_output(['nmcli','device','wifi','list']).decode('utf-8')
l = wifies.split('\n')
for x in l[1:]:
print(x[26:49],str('\n'))
wifi = input("type here any wifi name after seeing from above wifi list: ")
os.system('nmcli con up "' + wifi + '"')
def airplainmode():
x = input("turn on wifi or turn off wifi: ")
if x == 'turn off wifi':
os.system('nmcli r wifi off')
if x == 'turn on wifi':
os.system('nmcli r wifi on')
def wifi():
print('wifi settings')
x = input("wifi connection or air plain mode: ")
if x == 'wifi connection':
connecttowifi()
if x == 'air plain mode':
airplainmode()
def check_battery_percent():
init = psutil.sensors_battery()
x = int(init.percent)
print(x)
def battery():
print("battery settings")
x = input("the battery settings just has check battery percent then do you want to check the battery percentage: ")
if x == 'check battery percent':
check_battery_percent()
x = input("wifi settings or battery settings: ")
if x == 'wifi settings':
wifi()
if x == 'battery settings':
battery()