update uwu

This commit is contained in:
2025-02-16 19:01:28 +00:00
parent 461a8f9433
commit d4c2587fcd
11 changed files with 132 additions and 1039 deletions

View File

@@ -1,92 +0,0 @@
#!/usr/bin/env bash
# Print error message for invalid arguments
print_error() {
cat <<"EOF"
Usage: ./brightnesscontrol.sh <action>
Valid actions are:
i -- <i>ncrease brightness [+2%]
d -- <d>ecrease brightness [-2%]
EOF
}
# Send a notification with brightness info
send_notification() {
brightness=$(brightnessctl info | grep -oP "(?<=\()\d+(?=%)")
notify-send -r 91190 "Brightness: ${brightness}%"
}
# Get the current brightness percentage and device name
get_brightness() {
brightness=$(brightnessctl -m | grep -o '[0-9]\+%' | head -c-2)
device=$(brightnessctl -m | head -n 1 | awk -F',' '{print $1}' | sed 's/_/ /g; s/\<./\U&/g') # Get device name
current_brightness=$(brightnessctl -m | head -n 1 | awk -F',' '{print $3}') # Get current brightness
max_brightness=$(brightnessctl -m | head -n 1 | awk -F',' '{print $5}') # Get max brightness
}
get_brightness
# Handle options
while getopts o: opt; do
case "${opt}" in
o)
case $OPTARG in
i) # Increase brightness
if [[ $brightness -lt 10 ]]; then
brightnessctl set +1%
else
brightnessctl set +2%
fi
send_notification
;;
d) # Decrease brightness
if [[ $brightness -le 1 ]]; then
brightnessctl set 1%
elif [[ $brightness -le 10 ]]; then
brightnessctl set 1%-
else
brightnessctl set 2%-
fi
send_notification
;;
*)
print_error
;;
esac
;;
*)
print_error
;;
esac
done
# Determine the icon based on brightness level
get_icon() {
if ((brightness <= 5)); then
icon=""
elif ((brightness <= 15)); then
icon=""
elif ((brightness <= 30)); then
icon=""
elif ((brightness <= 45)); then
icon=""
elif ((brightness <= 55)); then
icon=""
elif ((brightness <= 65)); then
icon=""
elif ((brightness <= 80)); then
icon=""
elif ((brightness <= 95)); then
icon=""
else
icon=""
fi
}
# Backlight module and tooltip
get_icon
module="${icon} ${brightness}%"
tooltip="Device Name: ${device}"
tooltip+="\nBrightness: ${current_brightness} / ${max_brightness}"
echo "{\"text\": \"${module}\", \"tooltip\": \"${tooltip}\"}"

View File

@@ -1,64 +0,0 @@
#!/usr/bin/env bash
model=$(awk -F ': ' '/model name/{print $2}' /proc/cpuinfo | head -n 1 | sed 's/@.*//; s/ *\((R)\|(TM)\)//g; s/^[ \t]*//; s/[ \t]*$//')
# Get CPU clock speeds
get_cpu_frequency() {
freqlist=$(awk '/cpu MHz/ {print $4}' /proc/cpuinfo)
maxfreq=$(sed 's/...$//' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
average_freq=$(echo "$freqlist" | tr ' ' '\n' | awk "{sum+=\$1} END {printf \"%.0f/%s MHz\", sum/NR, $maxfreq}")
echo "$average_freq"
}
# Get CPU temperature
get_cpu_temperature() {
temp=$(sensors | awk '/Package id 0/ {print $4}' | awk -F '[+.]' '{print $2}')
if [[ -z "$temp" ]]; then
temp=$(sensors | awk '/Tctl/ {print $2}' | tr -d '+°C')
fi
if [[ -z "$temp" ]]; then
temp="N/A"
else
temp_f=$(awk "BEGIN {printf \"%.1f\", ($temp * 9 / 5) + 32}")
fi
echo "${temp:-N/A} ${temp_f:-N/A}"
}
# Get the corresponding icon based on temperature
get_temperature_icon() {
temp_value=$1
if [ "$temp_value" -ge 80 ]; then
icon="󰸁" # High temperature
elif [ "$temp_value" -ge 70 ]; then
icon="󱃂" # Medium temperature
elif [ "$temp_value" -ge 60 ]; then
icon="󰔏" # Normal temperature
else
icon="󱃃" # Low temperature
fi
echo "$icon"
}
# Main script execution
cpu_frequency=$(get_cpu_frequency)
read -r temp_info < <(get_cpu_temperature)
temp=$(echo "$temp_info" | awk '{print $1}') # Celsius
temp_f=$(echo "$temp_info" | awk '{print $2}') # Fahrenheit
# Determine the temperature icon
thermo_icon=$(get_temperature_icon "$temp")
# Set color based on temperature
if [ "$temp" -ge 80 ]; then
# If temperature is >= 80%, set color to #f38ba8
text_output="<span color='#f38ba8'>${thermo_icon} ${temp}°C</span>"
else
# Default color
text_output="${thermo_icon} ${temp}°C"
fi
tooltip="${model}\n"
tooltip+="Clock Speed: ${cpu_frequency}\nTemperature: ${temp_f}°F"
# Module and tooltip
echo "{\"text\": \"$text_output\", \"tooltip\": \"$tooltip\"}"

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env bash
# Get CPU model (removed "(R)", "(TM)", and clock speed)
model=$(awk -F ': ' '/model name/{print $2}' /proc/cpuinfo | head -n 1 | sed 's/@.*//; s/ *\((R)\|(TM)\)//g; s/^[ \t]*//; s/[ \t]*$//')
# Get CPU usage percentage
load=$(vmstat 1 2 | tail -1 | awk '{print 100 - $15}')
# Determine CPU state based on usage
if [ "$load" -ge 80 ]; then
state="Critical"
elif [ "$load" -ge 60 ]; then
state="High"
elif [ "$load" -ge 25 ]; then
state="Moderate"
else
state="Low"
fi
# Set color based on CPU load
if [ "$load" -ge 80 ]; then
# If CPU usage is >= 80%, set color to #f38ba8
text_output="<span color='#f38ba8'>󰀩 ${load}%</span>"
else
# Default color
text_output="󰻠 ${load}%"
fi
tooltip="${model}"
tooltip+="\nCPU Usage: ${state}"
# Module and tooltip
echo "{\"text\": \"$text_output\", \"tooltip\": \"$tooltip\"}"

View File

@@ -20,7 +20,7 @@ def signal_handler(sig, frame):
sys.stdout.write("\n")
sys.stdout.flush()
sys.exit(0)
class PlayerManager:
def __init__(self, selected_player=None, excluded_players=[]):
self.manager = Playerctl.PlayerManager()

View File

@@ -1,86 +0,0 @@
#!/usr/bin/env bash
# Check release
if [ ! -f /etc/arch-release ]; then
exit 0
fi
pkg_installed() {
local pkg=$1
if pacman -Qi "${pkg}" &>/dev/null; then
return 0
elif pacman -Qi "flatpak" &>/dev/null && flatpak info "${pkg}" &>/dev/null; then
return 0
elif command -v "${pkg}" &>/dev/null; then
return 0
else
return 1
fi
}
get_aur_helper() {
if pkg_installed yay; then
aur_helper="yay"
elif pkg_installed paru; then
aur_helper="paru"
fi
}
get_aur_helper
export -f pkg_installed
# Trigger upgrade
if [ "$1" == "up" ]; then
trap 'pkill -RTMIN+20 waybar' EXIT
command="
$0 upgrade
${aur_helper} -Syu
if pkg_installed flatpak; then flatpak update; fi
printf '\n'
read -n 1 -p 'Press any key to continue...'
"
kitty --title "󰞒 System Update" sh -c "${command}"
fi
# Check for AUR updates
if [ -n "$aur_helper" ]; then
aur_updates=$(${aur_helper} -Qua | grep -c '^')
else
aur_updates=0
fi
# Check for official repository updates
official_updates=$(
(while pgrep -x checkupdates >/dev/null; do sleep 1; done)
checkupdates | grep -c '^'
)
# Check for Flatpak updates
if pkg_installed flatpak; then
flatpak_updates=$(flatpak remote-ls --updates | grep -c '^')
else
flatpak_updates=0
fi
# Calculate total available updates
total_updates=$((official_updates + aur_updates + flatpak_updates))
# Handle formatting based on AUR helper
if [ "$aur_helper" == "yay" ]; then
[ "${1}" == upgrade ] && printf "Official: %-10s\nAUR ($aur_helper): %-10s\nFlatpak: %-10s\n\n" "$official_updates" "$aur_updates" "$flatpak_updates" && exit
tooltip="Official: $official_updates\nAUR ($aur_helper): $aur_updates\nFlatpak: $flatpak_updates"
elif [ "$aur_helper" == "paru" ]; then
[ "${1}" == upgrade ] && printf "Official: %-10s\nAUR ($aur_helper): %-10s\nFlatpak: %-10s\n\n" "$official_updates" "$aur_updates" "$flatpak_updates" && exit
tooltip="Official: $official_updates\nAUR ($aur_helper): $aur_updates\nFlatpak: $flatpak_updates"
fi
# Module and tooltip
if [ $total_updates -eq 0 ]; then
echo "{\"text\":\"󰸟\", \"tooltip\":\"Packages are up to date\"}"
else
echo "{\"text\":\"󰞒\", \"tooltip\":\"${tooltip//\"/\\\"}\"}"
fi