-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d1fe60
commit ededdb5
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
CURRENTPROFILE=$(powerprofilesctl get) | ||
|
||
if [[ $CURRENTPROFILE == "performance" ]] | ||
then | ||
exit 0 | ||
fi | ||
|
||
POWERSTATE=$(upower -i $(upower -e | grep BAT) | grep --color=never -E "state") | ||
|
||
if [[ $POWERSTATE == " state: charging" || $POWERSTATE == " state: fully-charged" ]] | ||
then | ||
|
||
powerprofilesctl set balanced | ||
sudo cpupower frequency-set -g ondemand | ||
|
||
else | ||
|
||
powerprofilesctl set power-saver | ||
cpupower frequency-set -g powersave | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
sh /opt/batterym/batter.sh | ||
|
||
|
||
sleep 300 | ||
|
||
sh /opt/batterym/batterservice.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
if [[ "$USER" != "root" ]]; then | ||
echo "Error: script not running as root or with sudo! Exiting..." | ||
exit 1 | ||
fi | ||
|
||
cp systemd/batterym.service /etc/systemd/system/ | ||
|
||
cp -r batterym /opt | ||
|
||
systemctl enable --now batterym.service | ||
|
||
echo "batterym install done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
After=power-profiles-daemon.service | ||
Description=custom battery governor for laptops | ||
|
||
[Service] | ||
ExecStart=/bin/sh -c "sh /opt/batterym/batterservice.sh" | ||
|
||
[Install] | ||
WantedBy=multi-user.target |