-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin_volume_control2.py
59 lines (38 loc) · 1.92 KB
/
plugin_volume_control2.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
50
51
52
53
54
55
56
57
58
59
# Управление громкостью через pamixer
# author: Oleg Bakharev (inspired by Vladislav Janvarev)
import subprocess
from vacore import VACore
def start(core: VACore):
manifest = {
"name": "Управление громкостью через pamixer",
"version": "1.0",
"require_online": False,
"commands": {
"без звука|выключи звук|заглушить звук|выключить звук|убрать звук|тишина" : off_volume,
"восстановить звук|включи звук|включить звук|верни звук|конец тишине" : on_volume,
"тише|уменьши громкость|уменьшить громкость|понизить громкость" : down_volume,
"громче|увеличь громкость|увеличить громкость|повысить громкость" : up_volume,
"полная громкость|звук на максимум|максимальная громкость" : maximal_volume,
"минимум звука|звук на минимум|минимальная громкость" : minimal_volume,
}
}
return manifest
def pass_arg_to_amixer(arg: str):
try:
cmd = subprocess.Popen(["pamixer"].append(arg.strip(" ")))
cmd.wait()
return
except Exception as e:
pass
def off_volume(core: VACore, phrase: str):
pass_arg_to_amixer("--mute")
def on_volume(core: VACore, phrase: str):
pass_arg_to_amixer("--unmute")
def down_volume(core: VACore, phrase: str):
pass_arg_to_amixer("--decrease 5")
def up_volume(core: VACore, phrase: str):
pass_arg_to_amixer("--increase 5")
def maximal_volume(core: VACore, phrase: str):
pass_arg_to_amixer("--set-volume 100")
def minimal_volume(core: VACore, phrase: str):
pass_arg_to_amixer("--set-volume 10")