diff --git a/.local/bin/fanctl b/.local/bin/fanctl deleted file mode 100755 index 0655c00..0000000 --- a/.local/bin/fanctl +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash -if [ -f ~/.local/bin/fanctl ]; then - # Read the values of text, class, and tooltip - source ~/.local/bin/stats/fanstat -fi - -# Function to check if a string is an integer -is_integer() { - [[ $1 =~ ^[0-9]+$ ]] -} - -# Function to format tooltip message (You need to define this function) -waybar_tooltip() { - # Replace this with your logic to format tooltip message if necessary - echo "$1" -} - -# Check if the correct number of arguments is provided -if [ $# -ne 1 ]; then - echo "Usage: $0 [min|max|auto|integer]" - exit 1 -fi - -# Initialize variables for the text, tooltip, and class -text="" -tooltip="" -class="" - -# Check the argument and execute the corresponding command -case $1 in - min) - nbfc set -f 0 1 -s 30 - text="min" - tooltip="30%" - class="min" - ;; - max) - nbfc set -f 0 1 -s 100 - text="max" - tooltip="100%" - class="max" - ;; - auto) - nbfc set -f 0 1 -a - text="auto" - tooltip="Auto" - class="auto" - ;; - incr) - if [[ $tooltipstat != "Auto" ]]; then - new_tooltipstat="${tooltipstat%?}" - new_speed=$(( $new_tooltipstat + 10)) - if [[ $new_speed -lt 100 ]]; then - nbfc set -f 0 1 -s $new_speed - text="custom" - tooltip="$new_speed%" - class="custom" - else - text=$textstat - tooltip="$tooltipstat" - class=$classstat - - fi - else - text=$textstat - tooltip="$tooltipstat" - class=$classstat - fi - ;; - decr) - if [[ $tooltipstat != "Auto" ]]; then - new_tooltipstat="${tooltipstat%?}" - new_speed=$(( $new_tooltipstat - 10)) - if [[ $new_speed -gt 0 ]]; then - nbfc set -f 0 1 -s $new_speed - text="custom" - tooltip="$new_speed%" - class="custom" - else - text=$textstat - tooltip="$tooltipstat" - class=$classstat - - fi - else - text=$textstat - tooltip="$tooltipstat" - class=$classstat - fi - ;; - *) - if is_integer "$1"; then # Check if argument is an integer - nbfc set -f 0 1 -s "$1" # Execute nbfc with the provided integer value - text="custom" - tooltip="$1%" - class="custom" - else - echo "Invalid argument. Usage: $0 [min|max|auto|integer]" - exit 1 - fi - ;; -esac - -# Output text, tooltip, and class to statfile -echo "textstat=$text" > ~/.local/bin/stats/fanstat -echo "tooltipstat=$(waybar_tooltip "$tooltip")" >> ~/.local/bin/stats/fanstat -echo "classstat=$class" >> ~/.local/bin/stats/fanstat - diff --git a/.local/bin/fanstat b/.local/bin/fanstat deleted file mode 100755 index c04102b..0000000 --- a/.local/bin/fanstat +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Check if the file exists -if [ -f ~/.local/bin/fanctl ]; then - # Read the values of text, class, and tooltip - source ~/.local/bin/stats/fanstat - - # Output the values in JSON format using printf - printf '{"text": "%s", "tooltip": "%s", "class": "%s"}\n' "$textstat" "$tooltipstat" "$classstat" -else - echo "{\"error\": \"File not found\"}" -fi diff --git a/.local/bin/stats/fanstat b/.local/bin/stats/fanstat deleted file mode 100644 index 81ffc21..0000000 --- a/.local/bin/stats/fanstat +++ /dev/null @@ -1,3 +0,0 @@ -textstat=auto -tooltipstat=Auto -classstat=auto