remove fancontrol
This commit is contained in:
@@ -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
|
|
||||||
|
|
||||||
@@ -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
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
textstat=auto
|
|
||||||
tooltipstat=Auto
|
|
||||||
classstat=auto
|
|
||||||
Reference in New Issue
Block a user