blob: 6babda5ada2eaed9272b98ad1995d89243bc0940 (
plain)
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
60
61
62
63
64
65
66
|
#!/bin/bash
function set_profile {
case $1 in
performance)
powerprofilesctl set performance
;;
balanced)
powerprofilesctl set balanced
;;
power-saver)
powerprofilesctl set power-saver
;;
*)
echo "Invalid profile. Please use 'performance', 'balanced', or 'power-saver'."
;;
esac
}
function get_profile {
powerprofilesctl get
}
function get_nficon {
profile=$1
case $profile in
performance)
echo ""
;;
balanced)
echo ""
;;
power-saver)
echo ""
;;
*)
echo "Invalid profile"
;;
esac
}
function send_notification {
profile=$(get_profile)
icon="power-profile-$profile-symbolic"
# Send the notification
dunstify -i $icon -t 2500 -r 2593 -u normal "Power Profile: $profile"
}
# Function to set the contents of "/tmp/powerprofile" to the current profile
function set_tmp_powerprofile {
profile=$(get_profile)
nficon=$(get_nficon $profile)
echo "$nficon $profile" > /tmp/powerprofile
}
case $1 in
performance|balanced|power-saver)
set_profile $1
send_notification
set_tmp_powerprofile
;;
*)
echo "Usage: $0 {performance|balanced|power-saver}"
exit 1
;;
esac
|