added .local/bin/ for scripts

This commit is contained in:
Joel Mathew Thomas
2024-04-11 00:22:49 +05:30
parent 3e490de80a
commit c6aa25647e
4 changed files with 91 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
# 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"
;;
*)
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="$1"
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 "text=$text" > ~/.local/bin/stats/fanstat
echo "tooltip=$(waybar_tooltip "$tooltip")" >> ~/.local/bin/stats/fanstat
echo "class=$class" >> ~/.local/bin/stats/fanstat
+12
View File
@@ -0,0 +1,12 @@
#!/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' "$text" "$tooltip" "$class"
else
echo "{\"error\": \"File not found\"}"
fi
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env sh
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
if [ "$HYPRGAMEMODE" = 1 ] ; then
hyprctl --batch "\
keyword animations:enabled 0;\
keyword decoration:drop_shadow 0;\
keyword decoration:blur:enabled 0;\
keyword general:gaps_in 0;\
keyword general:gaps_out 0;\
keyword general:border_size 1;\
keyword decoration:rounding 0"
exit
fi
hyprctl reload
+3
View File
@@ -0,0 +1,3 @@
text=min
tooltip=30%
class=min