diff --git a/powerprofilesctl/README.md b/powerprofilesctl/README.md new file mode 100644 index 00000000..a73a517a --- /dev/null +++ b/powerprofilesctl/README.md @@ -0,0 +1,18 @@ +# powerprofilesctl + +Shows the current powerprofile and gives the ability to change it by clicking on it. + +![powerprofilesctl-performance](./powerprofilesctl-performance.png) +![powerprofilesctl-balanced](./powerprofilesctl-balanced.png) +![powerprofilesctl-power-saver](./powerprofilesctl-power-saver.png) + +# Dependencies +- [powerprofilesctl](https://manpages.debian.org/unstable/power-profiles-daemon/powerprofilesctl.1.en.html) + +# Config +``` +[powerprofilesctl] +command=$SCRIPT_DIR/powerprofilesctl +label=🔌 +interval=30 +``` diff --git a/powerprofilesctl/powerprofilesctl b/powerprofilesctl/powerprofilesctl new file mode 100755 index 00000000..1ce1df7c --- /dev/null +++ b/powerprofilesctl/powerprofilesctl @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +get_power_state() { + powerprofilesctl | grep '*' | awk '{ print $2 }' | sed 's/: *//' +} + +toggle_power_state() { + current_state=$(get_power_state) + + if [ "$current_state" == "power-saver" ]; then + powerprofilesctl set performance + elif [ "$current_state" == "balanced" ]; then + powerprofilesctl set power-saver + else + powerprofilesctl set balanced + fi +} + +if [[ "$BLOCK_BUTTON" ]]; then + case "$BLOCK_BUTTON" in + 1) toggle_power_state;; + esac +fi + +echo "$(get_power_state)" diff --git a/powerprofilesctl/powerprofilesctl-balanced.png b/powerprofilesctl/powerprofilesctl-balanced.png new file mode 100644 index 00000000..0bf0a542 Binary files /dev/null and b/powerprofilesctl/powerprofilesctl-balanced.png differ diff --git a/powerprofilesctl/powerprofilesctl-performance.png b/powerprofilesctl/powerprofilesctl-performance.png new file mode 100644 index 00000000..0a9a948a Binary files /dev/null and b/powerprofilesctl/powerprofilesctl-performance.png differ diff --git a/powerprofilesctl/powerprofilesctl-power-saver.png b/powerprofilesctl/powerprofilesctl-power-saver.png new file mode 100644 index 00000000..634daa7d Binary files /dev/null and b/powerprofilesctl/powerprofilesctl-power-saver.png differ diff --git a/powerprofilesctl/powerprofilesctl.conf b/powerprofilesctl/powerprofilesctl.conf new file mode 100644 index 00000000..811bddb4 --- /dev/null +++ b/powerprofilesctl/powerprofilesctl.conf @@ -0,0 +1,4 @@ +[powerprofilesctl] +command=$SCRIPT_DIR/powerprofilesctl +label=🔌 +interval=30