-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset_power
54 lines (48 loc) · 1.03 KB
/
set_power
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
#!/bin/bash
# Programs list
apps=(
"Alfred"
"Cursor"
"Flux"
"Folder Peek"
"Menuwhere"
"Obsidian"
"PopClip"
"Slidepad"
"SoundSource"
"Termius"
"Vivaldi"
"AltTab"
"Little Snitch"
"Little Snitch Agent"
"Parallels Desktop"
"Widgetter"
)
activate_low_power() {
echo "Activating low power mode..."
for app in "${apps[@]}"; do
apps+=( "ProtonVPN" "prl_client_app")
killall "$app" 2>/dev/null
echo "$(tput setaf 1)$app$(tput sgr0) closed successfully."
done
# Enable Low Power Mode
sudo pmset -a powermode 0
}
activate_normal_mode() {
echo "Activating normal mode..."
for app in "${apps[@]}"; do
apps+=()
osascript -e "tell application \"$app\" to launch" &>/dev/null
echo "message"echo "$(tput setaf 2)$app$(tput sgr0) opened successfully."
done
# Disable Low Power Mode
sudo pmset -a powermode 1
}
if [ "$1" == "--low" ] || [ "$1" == "-l" ]; then
activate_low_power
elif [ "$1" == "--high" ] || [ "$1" == "-h" ]; then
activate_normal_mode
else
echo "Invalid flag. Use --low-power or --normal."
exit 2
fi