first commit
This commit is contained in:
29
waybar/scripts/app-icons.sh
Executable file
29
waybar/scripts/app-icons.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define tus apps favoritas y su ícono Unicode (usa Font Awesome u otra)
|
||||
declare -A apps=(
|
||||
["zen"]=""
|
||||
["kitty"]=""
|
||||
["nvim"]=""
|
||||
["ranger"]=""
|
||||
["steam"]=""
|
||||
)
|
||||
|
||||
# Colores (puedes personalizarlos desde CSS también)
|
||||
active_color="#b8bb26"
|
||||
inactive_color="#bdae93"
|
||||
|
||||
output=""
|
||||
|
||||
for app in "${!apps[@]}"; do
|
||||
icon="${apps[$app]}"
|
||||
# Detectar si el proceso está corriendo
|
||||
if pgrep -x "$app" > /dev/null; then
|
||||
output+="<span color='$active_color'>$icon</span> "
|
||||
else
|
||||
output+="<span color='$inactive_color'>$icon</span> "
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "$output"
|
||||
|
||||
21
waybar/scripts/cpu_info.sh
Executable file
21
waybar/scripts/cpu_info.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Obtener temperatura desde sysfs
|
||||
temp_raw=$(cat /sys/class/hwmon/hwmon2/temp1_input)
|
||||
temp_c=$((temp_raw / 1000))
|
||||
|
||||
# Obtener uso de CPU
|
||||
usage=$(grep 'cpu ' /proc/stat | awk '{u=$2+$4; t=$2+$4+$5; print u, t}')
|
||||
sleep 0.5
|
||||
usage2=$(grep 'cpu ' /proc/stat | awk '{u=$2+$4; t=$2+$4+$5; print u, t}')
|
||||
u1=$(echo $usage | awk '{print $1}')
|
||||
t1=$(echo $usage | awk '{print $2}')
|
||||
u2=$(echo $usage2 | awk '{print $1}')
|
||||
t2=$(echo $usage2 | awk '{print $2}')
|
||||
cpu_usage=$((100 * (u2 - u1) / (t2 - t1)))
|
||||
cpu_usage_formated=$(printf "%02d\n" $cpu_usage)
|
||||
temp_c_formated=$(printf "%02d\n" $temp_c)
|
||||
progress=$(sh ~/.config/waybar/scripts/status_bar.sh $cpu_usage)
|
||||
|
||||
# Imprimir formato
|
||||
echo " CPU ${temp_c}°C / ${cpu_usage_formated}% ${progress}"
|
||||
4
waybar/scripts/get_flag.py
Executable file
4
waybar/scripts/get_flag.py
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
flag=$(sh ~/scripts/get_flag.sh)
|
||||
|
||||
echo " ${flag}"
|
||||
12
waybar/scripts/gpu_temp.sh
Executable file
12
waybar/scripts/gpu_temp.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Obtener uso de la GPU con nvidia-smi
|
||||
usage=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | head -n 1)
|
||||
temp=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits | head -n 1)
|
||||
|
||||
temp_formated=$(printf "%02d\n" $temp)
|
||||
usage_formated=$(printf "%02d\n" $usage)
|
||||
|
||||
progress=$(sh ~/.config/waybar/scripts/status_bar.sh $usage)
|
||||
echo " GPU ${temp_formated}°C / ${usage_formated}% $progress"
|
||||
|
||||
28
waybar/scripts/hdd_info.sh
Executable file
28
waybar/scripts/hdd_info.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
local_hdd=$( df -h | grep /mnt/STEAM )
|
||||
IFS=' ' read -r -a partes <<< "$local_hdd"
|
||||
local_hdd=$( cut -c 1-2 <<< ${partes[4]} )
|
||||
local_hdd="[steam_"$local_hdd"%]"$( sh /home/arthur/.config/waybar/scripts/status_bar.sh $((local_hdd)))
|
||||
|
||||
system_hdd=$( df -h | grep nvme1n1p2)
|
||||
|
||||
if [ -z $system_hdd ]; then
|
||||
system_hdd=$( df -h | grep nvme0n1p2)
|
||||
fi
|
||||
|
||||
IFS=' ' read -r -a partes <<< "$system_hdd"
|
||||
system_hdd=$( cut -c 1-2 <<< ${partes[4]} )
|
||||
system_hdd="[sys_____"$system_hdd"%]"$( sh /home/arthur/.config/waybar/scripts/status_bar.sh $((system_hdd)))
|
||||
|
||||
#raspberry info
|
||||
hdd2=$( ssh arthur@192.168.1.131 "df -h" | grep /media/HDD2 )
|
||||
|
||||
if [ -z "$hdd2" ]; then
|
||||
echo "|.:" $local_hdd ":.|
|.:" $system_hdd ":.|"
|
||||
else
|
||||
IFS=' ' read -r -a partes <<< "$hdd2"
|
||||
hdd2=$( cut -c 1-2 <<< ${partes[4]})
|
||||
hdd2="[hdd2___"$hdd2"%]"$( sh /home/arthur/.config/waybar/scripts/status_bar.sh $((hdd2)))
|
||||
echo "|.:" $local_hdd ":.|
|.:" $system_hdd ":.|
|.: "$hdd2" :.|"
|
||||
fi
|
||||
34
waybar/scripts/status_bar.sh
Executable file
34
waybar/scripts/status_bar.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
totalval=$1
|
||||
|
||||
usage_10=$((totalval/10))
|
||||
progress=""
|
||||
max=8
|
||||
|
||||
for (( i=1; (( i <= max )); i++ )); do
|
||||
if (( i == 1 )); then
|
||||
if (( usage_10 >= i )); then
|
||||
progress=""
|
||||
else
|
||||
progress=""
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( usage_10 <= i )); then
|
||||
progress=$progress""
|
||||
else
|
||||
progress=$progress""
|
||||
fi
|
||||
|
||||
if (( i==max )); then
|
||||
if (( usage_10 >= max+2 )); then
|
||||
progress=$progress""
|
||||
break;
|
||||
else
|
||||
progress=$progress""
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo $progress
|
||||
5
waybar/scripts/uptime.sh
Executable file
5
waybar/scripts/uptime.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Devuelve el tiempo encendido del sistema en formato legible
|
||||
uptime -p | sed 's/up //'
|
||||
|
||||
15
waybar/scripts/weather.sh
Executable file
15
waybar/scripts/weather.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
API_KEY="bc07f366f9c10599a7700f80cc66e0d6"
|
||||
CITY_ID="3583361" # Puedes encontrarlo en https://openweathermap.org/find?q=San+Salvador
|
||||
UNITS="metric" # o "imperial" para Fahrenheit
|
||||
|
||||
WEATHER=$(curl -sf "https://api.openweathermap.org/data/2.5/weather?id=${CITY_ID}&appid=${API_KEY}&units=${UNITS}")
|
||||
|
||||
if [ "$WEATHER" != "" ]; then
|
||||
TEMP=$(echo "$WEATHER" | jq '.main.temp' | cut -d "." -f 1)
|
||||
ICON=$(echo "$WEATHER" | jq -r '.weather[0].icon')
|
||||
echo ".: ${TEMP} :."
|
||||
else
|
||||
echo ".: Weather unavailable :."
|
||||
fi
|
||||
47
waybar/scripts/workspaces_icons.py
Executable file
47
waybar/scripts/workspaces_icons.py
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
icons = {
|
||||
"firefox": "",
|
||||
"kitty": "",
|
||||
"code": "",
|
||||
"nemo": "",
|
||||
"discord": "",
|
||||
"spotify": "",
|
||||
}
|
||||
|
||||
def get_windows():
|
||||
result = subprocess.run(["hyprctl", "clients", "-j"], stdout=subprocess.PIPE)
|
||||
return json.loads(result.stdout)
|
||||
|
||||
def get_workspaces():
|
||||
result = subprocess.run(["hyprctl", "workspaces", "-j"], stdout=subprocess.PIPE)
|
||||
return json.loads(result.stdout)
|
||||
|
||||
def main():
|
||||
windows = get_windows()
|
||||
workspaces = get_workspaces()
|
||||
|
||||
ws_icons = {}
|
||||
|
||||
for ws in workspaces:
|
||||
ws_id = ws["id"]
|
||||
ws_icons[ws_id] = []
|
||||
|
||||
for win in windows:
|
||||
app = win["class"].lower()
|
||||
ws_id = win["workspace"]["id"]
|
||||
icon = icons.get(app, "?")
|
||||
if icon not in ws_icons[ws_id]:
|
||||
ws_icons[ws_id].append(icon)
|
||||
|
||||
output = " ".join(
|
||||
f"{ws}:{''.join(ws_icons[ws])}" for ws in sorted(ws_icons.keys())
|
||||
)
|
||||
|
||||
print(output)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
30
waybar/scripts/xpu_info.sh
Executable file
30
waybar/scripts/xpu_info.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Obtener uso de la GPU con nvidia-smi
|
||||
usage=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | head -n 1)
|
||||
temp=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits | head -n 1)
|
||||
|
||||
temp_formated=$(printf "%02d\n" $temp)
|
||||
usage_formated=$(printf "%02d\n" $usage)
|
||||
|
||||
progress_gpu=$(sh ~/.config/waybar/scripts/status_bar.sh $usage)
|
||||
|
||||
# Obtener temperatura desde sysfs
|
||||
temp_raw=$(cat /sys/class/hwmon/hwmon2/temp1_input)
|
||||
temp_c=$((temp_raw / 1000))
|
||||
|
||||
# Obtener uso de CPU
|
||||
usage=$(grep 'cpu ' /proc/stat | awk '{u=$2+$4; t=$2+$4+$5; print u, t}')
|
||||
sleep 0.5
|
||||
usage2=$(grep 'cpu ' /proc/stat | awk '{u=$2+$4; t=$2+$4+$5; print u, t}')
|
||||
u1=$(echo $usage | awk '{print $1}')
|
||||
t1=$(echo $usage | awk '{print $2}')
|
||||
u2=$(echo $usage2 | awk '{print $1}')
|
||||
t2=$(echo $usage2 | awk '{print $2}')
|
||||
cpu_usage=$((100 * (u2 - u1) / (t2 - t1)))
|
||||
cpu_usage_formated=$(printf "%02d\n" $cpu_usage)
|
||||
temp_c_formated=$(printf "%02d\n" $temp_c)
|
||||
progress=$(sh ~/.config/waybar/scripts/status_bar.sh $cpu_usage)
|
||||
|
||||
# Imprimir formato
|
||||
echo " CPU ${temp_c}°C / ${cpu_usage_formated}% ${progress} 
 "" GPU ${temp_formated}°C / ${usage_formated}% $progress_gpu"
|
||||
Reference in New Issue
Block a user