waybar arch news module and scripts

This commit is contained in:
teraflops 2025-06-24 20:14:07 +02:00
parent 53675c9b03
commit 44dc8e3e00
Signed by: teraflops
GPG Key ID: 2B77D97AF6F8968C
13 changed files with 1422 additions and 141 deletions

View File

@ -17,7 +17,11 @@
"memory",
// "custom/updates",
"custom/fans",
"custom/weather"
"custom/weather",
"custom/btrfs",
//"custom/mouse_battery",
//"custom/headset_battery"
"custom/news"
// "custom/mpris-buttons"
],
"modules-center": [
@ -39,11 +43,41 @@
"network",
"wireplumber",
"custom/pwrate",
"custom/mouse_battery",
"custom/headset_battery",
"battery",
"custom/powermenu"
//"hyprland/language"
//"pulseaudio/slider",
],
"custom/headset_battery": {
"exec": "~/.config/waybar/scripts/headset_battery.sh",
"interval": 20,
"return-type": "json",
"signal": 23
},
"custom/mouse_battery": {
"exec": "~/.config/waybar/scripts/mouse_battery.sh",
"interval": 20,
"return-type": "json"
},
"custom/news": {
"exec": "~/.config/waybar/scripts/arch_news.py",
"interval": 600,
"return-type": "json",
"tooltip": true,
"on-click": "~/.config/waybar/scripts/mark_news_read.py",
"on-click-right": "~/.config/waybar/scripts/open_news_url.sh"
},
"custom/btrfs": {
"format": "{}",
"exec": "~/.config/waybar/scripts/btrfs_module.sh",
"interval": 180,
"return-type": "json",
"tooltip": true
},
"custom/roon": {
"exec": "cat /tmp/waybar_roon_info.json",
"format": "{text}",
@ -338,7 +372,6 @@
"tooltip-format-wifi": "{essid}",
"tooltip-format-disconnected": "Disconnected",
"nospacing": 1,
"on-click": "/home/teraflops/.config/waybar/scripts/wifi_menu.py",
},
//"battery": {
// "bat": "BAT1", // Usa el identificador correcto de tu batería
@ -353,30 +386,18 @@
//"check_health": "notify send 2",
//"activate_saving_mode": "notify send 3",
//},
"battery": {
"battery": {
"interval": 60,
"states": {
"warning": 30,
"critical": 15,
},
"format": "{icon}",
"format-charging": " ",
"format-plugged": "{icon}",
"format-icons": [
" ",
" ",
" ",
" ",
" "
],
"max-length": 18,
"menu": "on-click",
"menu-file": "/home/teraflops/.config/waybar/menu/battery_menu.xml",
"menu-actions": {
"view_details": "/home/teraflops/.config/waybar/scripts/view_battery_details_yad.sh",
"check_health": "/home/teraflops/.config/waybar/scripts/check_battery_health.sh",
},
"critical": 15
},
//"format": "{icon} {capacity}%",
"format": "<span size='large'></span> {capacity}%",
"format-plugged": "<span size='large'></span> {capacity}%",
"format-icons": ["", "", "", "", ""],
"max-length": 25
},
"wireplumber": {
"format": "{icon}",
"nospacing": 1,
@ -390,7 +411,6 @@
"󰕾 "
],
},
"on-click": "/home/teraflops/.config/waybar/scripts/volume_menu.py",
"on-click-right": "pavucontrol",
"on-update": "/usr/bin/pkill -RTMIN+23 waybar",
// "on-update": "/home/teraflops/.local/bin/show_rate.sh",

View File

@ -0,0 +1,417 @@
{
"layer": "top",
"position": "top",
"margin-top": 1,
"margin-left": 1,
"margin-right": 1,
"margin-bottom": 1,
"height": 54,
"spacing": 0,
"modules-left": [
"custom/launcher",
"hyprland/workspaces",
"cpu",
// "temperature",
"custom/temps",
"power-profiles-daemon",
"memory",
// "custom/updates",
"custom/fans",
"custom/weather",
"custom/btrfs"
// "custom/news"
// "custom/mpris-buttons"
],
"modules-center": [
"custom/calendar_clock"
],
"modules-right": [
//"mpd",
//"custom/rate",
// "image#test",
// "custom/dmp_nowplaying",
"custom/eww_nowplaying",
"custom/lyrics",
"mpris",
"custom/roon",
"tray",
"custom/wf-recorder",
//"image#gpu",
"bluetooth",
"network",
"wireplumber",
"custom/pwrate",
"custom/mouse_battery",
"custom/headset_battery",
"battery",
"custom/powermenu"
//"hyprland/language"
//"pulseaudio/slider",
],
"custom/headset_battery": {
"exec": "~/.config/waybar/scripts/headset_battery.sh",
"interval": 60,
"return-type": "json"
},
"custom/mouse_battery": {
"exec": "~/.config/waybar/scripts/mouse_battery.sh",
"interval": 60,
"return-type": "json"
},
"custom/arch_news": {
"exec": "~/.config/waybar/scripts/arch_news.py",
"interval": 600, // cada 10 minutos
"tooltip": true
},
"custom/btrfs": {
"format": "{}",
"exec": "~/.config/waybar/scripts/btrfs_module.sh",
"interval": 180,
"return-type": "json",
"tooltip": true
},
"custom/roon": {
"exec": "cat /tmp/waybar_roon_info.json",
"format": "{text}",
"tooltip": true,
"return-type": "json",
"signal": 3
},
"custom/temps": {
"exec": "~/.config/waybar/scripts/temps.sh",
"interval": 10,
"return-type": "json",
"tooltip": true,
"on-click": "~/.config/waybar/scripts/temps.sh click"
},
"custom/dmp_nowplaying": {
"exec": "~/.config/waybar/scripts/dmp_nowplaying.sh",
"return-type": "json",
"interval": 5,
"tooltip": true
},
"custom/eww_nowplaying": {
"exec": "echo '🎶 '",
"interval": 3600, // No es dinámico, solo muestra el ícono
"tooltip": false,
"on-click": "~/.config/eww/scripts/toggle_nowplaying.sh"
},
"custom/fans": {
"exec": "~/.config/waybar/scripts/fan_speed.sh",
"format": "{text}",
"return-type": "json",
"on-click": "~/.config/waybar/scripts/fan_speed.sh next",
"on-click-right": "~/.config/waybar/scripts/toggle_fans.sh",
"interval": 5,
"tooltip": true
},
"custom/updates": {
"format": "{text}",
"exec": "/bin/bash /home/teraflops/.config/waybar/scripts/updates.sh",
"interval": 300,
"return-type": "json",
"tooltip": true,
},
"hyprland/language": {
"format-es": "es",
"format-en": "us",
"keyboard-name": "asus-keyboard",
"keyboard-name": "melgeek-mojo68-c1-keyboard",
"keyboard-name": "mwstudio-mmkzoo65-keyboard",
"on-click": "hyprctl switchxkblayout mwstudio-mmkzoo65-keyboard next"
},
"custom/mpris-buttons": {
"exec": "~/.config/waybar/scripts/mpris_buttons.sh",
// "interval": 1,
"return-type": "json",
"on-click": "playerctl play-pause",
"on-click-right": "playerctl next",
"on-click-middle": "playerctl previous",
"signal": 24
},
"pulseaudio/slider": {
"min": 0,
"max": 100,
"orientation": "vertical"
},
"custom/network_speed": {
"exec": "/home/teraflops/.local/bin/network_speed_client.py",
"interval": 1,
"return-type": "json",
"format": "{}",
"tooltip": true,
},
"image#gpu": {
"exec": "/tmp/gpu.sh",
"size": 18,
// "interval": 1,
// "signal": 3,
"tooltip": true,
"on-click": "python /home/teraflops/.local/bin/comandos.py",
},
"custom/lyrics": {
"format": "{text}",
"exec": "/home/teraflops/.config/waybar/scripts/lyrics_module.sh",
"return-type": "json",
"escape": true,
"interval": 10,
"on-empty": "hide",
//"on-click": "termite -t playlist -e ncmpcpp",
"on-click": "/home/teraflops/.config/waybar/scripts/show_cover.py",
//"on-scroll-down": "/home/teraflops/.config/waybar/scripts/lyrics_scroll.sh",
"signal": 9
},
"mpris": {
"format": "{title}",
"format-paused": "⏸ {title}",
"tooltip-format": "{title}\n{artist} ",
//"title-len": 20,
"artist-len": 0,
"album-len": 0,
"dynamic-len": 20,
"ellipsis": "…",
"expand": false,
"max-length": 60,
// "min-length": 25,
"tooltip": true,
//"ignored-players": ["firefox"],
},
"hyprland/workspaces": {
"on-click": "activate",
"format": "{icon}",
"format-icons": {
"default": "",
"1": "",
"2": "",
"3": "",
"4": "",
"active": "󱓻",
"urgent": "󱓻",
},
"persistent-workspaces": {
"*": 4,
},
},
"custom/inetspeedup": {
"format": "{}",
"exec": "/home/teraflops/.config/waybar/scripts/inetup.py",
"on-click": "/home/teraflops/.config/waybar/scripts/inetup.py toggle",
"interval": 10,
"return-type": "json",
"signal": 20,
},
"custom/inetspeeddown": {
"format": "{}",
"exec": "/home/teraflops/.config/waybar/scripts/inetdown.py",
"on-click": "/home/teraflops/.config/waybar/scripts/inetdown.py toggle",
"interval": 10,
"return-type": "json",
"signal": 21,
},
"custom/borg": {
//pkill -RTMIN+12 waybar
"format": "BACKUP RUNNING",
"exec": "echo '{\"class\": \"running\"}'",
"exec-if": "pgrep -x pika-backup",
"return-type": "json",
"signal": 12,
},
"custom/wf-recorder": {
//pkill -RTMIN+11 waybar
"format": "• ",
"exec": "echo '{\"class\": \"recording\"}'",
"exec-if": "pgrep -x wf-recorder",
"return-type": "json",
"signal": 11,
},
"custom/tailscale": {
"format": "VPN",
"exec": "echo '{\"class\": \"vpn\"}'",
"exec-if": "pgrep -x tailscaled",
"return-type": "json",
"signal": 22,
},
"custom/pwrate": {
"exec": "/home/teraflops/.local/bin/pwrate3.sh",
"return-type": "json",
"format": "{}",
"signal": 23
},
"custom/rate": {
//pkill -RTMIN+15 waybar
//"exec": "/home/teraflops/.local/bin/show_rate.sh",
"exec": "python /home/teraflops/.local/bin/now_playing_tooltip.py",
//"exec": "echo '{\"text\":\"🎵\", \"tooltip\":\"Testing Tooltip\"}'", // Simple test module
"tooltip": true,
"return-type": "json",
"escape": false,
"on-click": "python /home/teraflops/.local/bin/now_playing_tooltip.py toggle",
"on-click-right": "pkill -Af now_playing_tooltip.py",
"signal": 15,
"class": "rate-module",
},
"backlight": {
"device": "amdgpu_bl1",
"format": "{icon}",
"format-icons": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
],
},
"custom/weather": {
"exec": "python ~/.config/waybar/scripts/weather.py",
"restart-interval": 300,
"return-type": "json",
// "on-click": "xdg-open https://weather.com/en-IN/weather/today/l/$(location_id)"
// "format-alt": "{alt}",
},
"bluetooth": {
"format": "",
"format-connected": "",
"format-connected-battery": "󰂴 ",
"tooltip-format": "{controller_alias}\t{controller_address}\n\n{num_connections} connected",
"tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}",
"tooltip-format-enumerate-connected": "{device_alias}\t{device_address}",
"tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%",
"on-click": "/home/teraflops/.config/waybar/scripts/bt_menu.py",
},
"hyprland/window": {
"max-length": 60,
"format": "<span font='11' rise='-4444'>{}</span>",
"separate-outputs": true,
},
"temperature": {
"hwmon-path": [
"/sys/class/thermal/thermal_zone0/temp"
],
"critical-threshold": 80,
"format-critical": "{temperatureC}°C",
"format": "{temperatureC}°C",
},
"memory": {
"interval": 3,
"format": "  {}% ",
"max-length": 10,
},
"cpu": {
"interval": 1,
"format": "{icon} {usage:>2}%",
"format-icons": [
"􏘭 ",
"􏘬 ",
"􏘩 ",
"􏘪 ",
"􏘫 "
],
},
"power-profiles-daemon": {
"format": "{icon}",
"tooltip-format": "Power profile: {profile}\nDriver: {driver}",
"tooltip": true,
"format-icons": {
"default": "BAL",
"performance": "PERF",
"balanced": "BAL",
"power-saver": "PSAV",
},
},
"custom/powermenu": {
"format": "⏻ ",
"tooltip": false,
"on-click": "/home/teraflops/.config/waybar/scripts/wlogout.sh",
},
"tray": {
"icon-size": 18,
"spacing": 10,
},
"custom/calendar_clock": {
"exec": "python3 /home/teraflops/.local/bin/list_events_v5_json.py",
"interval": 120,
"tooltip": true,
"return-type": "json",
},
"network": {
"format-wifi": "{icon}",
"format-disconnected": "󰤭 ",
"format-icons": [
"󰤯 ",
"󰤟 ",
"󰤢 ",
"󰤥 ",
"󰤨 "
],
"tooltip-format-wifi": "{essid}",
"tooltip-format-disconnected": "Disconnected",
"nospacing": 1,
},
//"battery": {
// "bat": "BAT1", // Usa el identificador correcto de tu batería
//"interval": 60,
//"format": "{icon}",
//"tooltip": false,
//"format-icons": ["", "", "", "", ""],
//"menu": "on-click",
//"menu-file": "/home/teraflops/.config/waybar/menu/battery_menu.xml",
//"menu-actions": {
// "view_details": "notify send 1",
//"check_health": "notify send 2",
//"activate_saving_mode": "notify send 3",
//},
"battery": {
"interval": 60,
"states": {
"warning": 30,
"critical": 15
},
//"format": "{icon} {capacity}%",
"format": "<span size='large'></span> {capacity}%",
"format-plugged": "<span size='large'></span> {capacity}%",
"format-icons": ["", "", "", "", ""],
"max-length": 25
},
"wireplumber": {
"format": "{icon}",
"nospacing": 1,
"tooltip-format": "Volume : {volume}%",
"format-muted": "󰝟 ",
"format-icons": {
"headphone": " ",
"default": [
"󰕿 ",
"󰖀 ",
"󰕾 "
],
},
"on-click-right": "pavucontrol",
"on-update": "/usr/bin/pkill -RTMIN+23 waybar",
// "on-update": "/home/teraflops/.local/bin/show_rate.sh",
"scroll-step": 3,
},
"custom/launcher": {
"format": "  ",
"tooltip": false,
"on-click": "/home/teraflops/.config/rofi/launchers/misc/launcher.sh &",
},
}

View File

@ -0,0 +1,55 @@
#!/usr/bin/env python3
import feedparser
import json
import os
cache_dir = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache"))
title_file = os.path.join(cache_dir, "arch_news_last_title")
url_file = os.path.join(cache_dir, "arch_news_last_url")
read_file = os.path.join(cache_dir, "arch_news_read")
feed_url = "https://archlinux.org/feeds/news/"
def fetch_latest_news():
try:
feed = feedparser.parse(feed_url)
if not feed.entries:
return {"text": "", "tooltip": "", "class": ""}
latest = feed.entries[0]
title = latest.title.strip()
link = latest.link.strip()
# Guardar título y URL de la última noticia
os.makedirs(cache_dir, exist_ok=True)
with open(title_file, "w") as f:
f.write(title)
with open(url_file, "w") as f:
f.write(link)
# Leer la última noticia leída
read_title = ""
if os.path.exists(read_file):
with open(read_file, "r") as f:
read_title = f.read().strip()
if title == read_title:
return {"text": "", "tooltip": "", "class": ""}
return {
"text": "NEWS",
"tooltip": title,
"class": "news-alert"
}
except Exception as e:
return {
"text": "NEWS",
"tooltip": "Error al obtener noticias",
"class": "error"
}
if __name__ == "__main__":
print(json.dumps(fetch_latest_news()))

View File

@ -0,0 +1,73 @@
#!/usr/bin/env bash
export LC_NUMERIC=C
ROOT="/"
HOME="/home"
[ -d "$HOME" ] || HOME=""
# Capturar salidas
df_home=$(sudo btrfs filesystem df "$HOME" 2>/dev/null)
usage_root=$(sudo btrfs filesystem usage "$ROOT" 2>/dev/null)
# Extraer solo el bloque Overall:
overall_block=$(awk '/^Overall:/{p=1} p' <<<"$usage_root")
# Función para obtener token numérico+unidad
get_tok(){
awk -v key="$1" 'index($0,key){
for(i=1;i<=NF;i++) if($i ~ /^[0-9]+(\.[0-9]+)?(KiB|MiB|GiB|TiB|PiB)$/) {print $i; exit}
}' <<<"$usage_root"
}
free_tok=$(get_tok "Free (estimated):")
tot_tok=$(get_tok "Device size:")
# Validar tokens
if [[ -z "$free_tok" || -z "$tot_tok" ]]; then
echo '{"text":"Err","tooltip":"Error extrayendo valores Btrfs","class":"error","color":"#ff5555"}'
exit 1
fi
# Separar número y unidad
free_num=${free_tok%[KMGTP]iB}; free_unit=${free_tok#"$free_num"}
tot_num=${tot_tok%[KMGTP]iB}; tot_unit=${tot_tok#"$tot_num"}
# Convertir coma a punto
free_num=${free_num//,/.}
tot_num=${tot_num//,/.}
# Conversión a GiB
to_gib(){
case "$2" in
KiB) factor=0.000001;; MiB) factor=0.001;; GiB) factor=1;;
TiB) factor=1024;; PiB) factor=1048576;; *) factor=1;;
esac
echo "$1 * $factor" | bc -l
}
free_gb=$(to_gib "$free_num" "$free_unit")
tot_gb=$(to_gib "$tot_num" "$tot_unit")
# Validar conversión
if [[ -z "$free_gb" || -z "$tot_gb" ]]; then
echo '{"text":"Err","tooltip":"Error conversión a GiB","class":"error","color":"#ff5555"}'
exit 1
fi
# Calcular % libre
pct=$(awk -v f="$free_gb" -v t="$tot_gb" 'BEGIN{printf "%.0f", (f/t)*100}')
# Color según umbral
if (( pct < 10 )); then color="#ff5555"
elif (( pct < 20 )); then color="#f1fa8c"
else color="#50fa7b"
fi
# Icono FontAwesome (U+F0A0)
icon=$'\uf0a0'
# Escapar para JSON
escape(){ sed ':a;N;$!ba;s/\\/\\\\/g;s/"/\\"/g;s/\n/\\n/g'; }
tooltip=$(echo -e "$overall_block" | escape)
# Salida JSON
printf '{"text":"%s %s%%","tooltip":"%s","color":"%s"}' "$icon" "$pct" "$tooltip" "$color"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
STATE_FILE="/tmp/fancycle_state"
HWMON_PATH="/sys/class/hwmon/hwmon3" # Ajusta según tu caso
HWMON_PATH="/sys/class/hwmon/hwmon7" # Ajusta según tu caso
# Si no existe el archivo de estado, inícialo en 1 (fan1)
if [[ ! -f "$STATE_FILE" ]]; then
@ -27,20 +27,14 @@ fan1_speed=$(cat "$HWMON_PATH/fan1_input" 2>/dev/null)
fan2_label=$(cat "$HWMON_PATH/fan2_label" 2>/dev/null | sed 's/_fan//I' | tr '[:lower:]' '[:upper:]')
fan2_speed=$(cat "$HWMON_PATH/fan2_input" 2>/dev/null)
fan3_label=$(cat "$HWMON_PATH/fan3_label" 2>/dev/null | sed 's/_fan//I' | tr '[:lower:]' '[:upper:]')
fan3_speed=$(cat "$HWMON_PATH/fan3_input" 2>/dev/null)
# Prepara el tooltip con TODOS los ventiladores
tooltip="${fan1_label}: ${fan1_speed} RPM
${fan2_label}: ${fan2_speed} RPM
${fan3_label}: ${fan3_speed} RPM"
tooltip="${fan1_label}: ${fan1_speed}
${fan2_label}: ${fan2_speed}"
# Según el "estado", decide cuál ventilador se muestra en "text"
case "$state" in
1) text="${fan1_label}: ${fan1_speed} RPM" ;;
2) text="${fan2_label}: ${fan2_speed} RPM" ;;
3) text="${fan3_label}: ${fan3_speed} RPM" ;;
1) text="${fan1_label}: ${fan1_speed}" ;;
2) text="${fan2_label}: ${fan2_speed}" ;;
esac
# Usa jq para generar JSON

View File

@ -0,0 +1,22 @@
#!/bin/bash
ICON=""
MAC="88:C9:E8:EF:69:1E"
INFO=$(bluetoothctl info "$MAC")
# Si no está conectado, no mostrar nada
if ! echo "$INFO" | grep -q "Connected: yes"; then
echo ""
exit 0
fi
# Extraer el valor dentro de paréntesis (por ejemplo, 50)
PCT=$(echo "$INFO" | awk -F'[()]' '/Battery Percentage/ {gsub(/ /,""); print $2}')
if [[ -n "$PCT" ]]; then
echo "{\"text\": \"$ICON ${PCT}%\", \"tooltip\": \"Batería del headset: ${PCT}%\"} "
else
echo "{\"text\": \"$ICON\", \"tooltip\": \"Headset conectado, batería desconocida\"} "
fi

View File

@ -0,0 +1,38 @@
#!/bin/bash
# Configuración: Reemplaza 'TU_API_KEY' con tu clave de API de Musixmatch
API_KEY="9f48b41952ed1a7808f0069395f6ed60"
# Obtener artista y título
artist=$(playerctl metadata artist 2>/dev/null)
title=$(playerctl metadata title 2>/dev/null)
# Verificar si los valores se obtuvieron correctamente
if [[ -z "$artist" || -z "$title" ]]; then
jq -c -n --arg text "" '{"text":$text}'
exit 0
fi
# Codificar los valores para la URL
artist_url=$(echo "$artist" | jq -s -R -r @uri)
title_url=$(echo "$title" | jq -s -R -r @uri)
# Obtener las letras usando la API de Musixmatch
response=$(curl -s "https://api.musixmatch.com/ws/1.1/matcher.lyrics.get?q_track=$title_url&q_artist=$artist_url&apikey=$API_KEY")
# Extraer las letras del JSON de respuesta
lyrics=$(echo "$response" | jq -r '.message.body.lyrics.lyrics_body')
# Manejar errores y limpiar las letras
if [[ "$lyrics" == "null" || -z "$lyrics" ]]; then
lyrics="Letras no encontradas."
else
# Eliminar retornos de carro y líneas vacías
lyrics=$(echo "$lyrics" | tr -d '\r' | sed '/^[[:space:]]*$/d')
# Eliminar la línea de uso comercial de Musixmatch
lyrics=$(echo "$lyrics" | sed '/This Lyrics is NOT for Commercial use/d')
fi
# Generar JSON compacto y seguro
jq -c -n --arg text "🎵" --arg tooltip "$lyrics" '{"text":$text,"tooltip":$tooltip}'

View File

@ -0,0 +1,15 @@
#!/usr/bin/env python3
import os
cache_dir = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache"))
title_file = os.path.join(cache_dir, "arch_news_last_title")
read_file = os.path.join(cache_dir, "arch_news_read")
try:
if os.path.exists(title_file):
with open(title_file, "r") as src, open(read_file, "w") as dst:
dst.write(src.read())
except Exception as e:
print(f"Error: {e}")

View File

@ -0,0 +1,29 @@
#!/bin/bash
ICON=""
DEVICE="/org/freedesktop/UPower/devices/mouse_dev_D0_DA_DD_A3_9C_69"
# Si no existe el dispositivo, no mostrar nada
if ! upower -i "$DEVICE" &>/dev/null; then
echo ""
exit 0
fi
# Verificar si el dispositivo está presente (i.e., conectado)
PRESENT=$(upower -i "$DEVICE" | awk '/present:/ {print $2}')
if [[ "$PRESENT" != "yes" ]]; then
echo ""
exit 0
fi
# Obtener porcentaje
PCT=$(upower -i "$DEVICE" | awk '/percentage/ {print $2}' | tr -d '%')
# Si no hay porcentaje válido, ocultar
if [[ -z "$PCT" ]]; then
echo ""
exit 0
fi
echo "{\"text\": \"$ICON ${PCT}%\", \"tooltip\": \"Batería del ratón: ${PCT}% \"}"

View File

@ -0,0 +1,8 @@
#!/bin/bash
URL_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/arch_news_last_url"
if [[ -f "$URL_FILE" ]]; then
xdg-open "$(cat "$URL_FILE")"
fi

View File

@ -1,76 +1,86 @@
#!/bin/bash
#!/usr/bin/env bash
STATE_FILE="/tmp/waybar_temp_mode"
MODES=("cpu" "igpu" "dgpu")
# Detecta si la dGPU está realmente activa
# ¿Está activa la dGPU?
dgpu_is_active() {
runtime_status=$(cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status 2>/dev/null)
[[ "$runtime_status" == "active" ]]
# Comprueba el estado de energía de la NVIDIA
local status
status=$(cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status 2>/dev/null)
[[ "$status" == "active" ]]
}
get_dgpu_temp() {
if dgpu_is_active; then
nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits 2>/dev/null || echo "N/A"
# Usa nvidia-smi si la dGPU está activada
nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits 2>/dev/null \
|| echo "N/A"
else
echo "N/A"
fi
}
get_cpu_temp() {
sensors | awk '/^Tctl:/ {print $2}' | sed 's/+//;s/°C//'
sensors \
| awk '/^Tctl:/ {print $2; exit}' \
| sed 's/+//;s/°C//'
}
get_igpu_temp() {
sensors | awk '/amdgpu/ {found=1} found && /edge:/ {print $2; exit}' | sed 's/+//;s/°C//'
sensors \
| awk '/amdgpu/ {found=1} found && /edge:/ {print $2; exit}' \
| sed 's/+//;s/°C//'
}
get_nvme_temp() {
sensors | awk '/nvme/ {found=1} found && /Composite:/ {print $2; exit}' | sed 's/+//;s/°C//'
sensors \
| awk '/nvme/ {found=1} found && /Composite:/ {print $2; exit}' \
| sed 's/+//;s/°C//'
}
get_board_temp() {
sensors | awk '/temp1:/ && /°C/ {print $2; exit}' | sed 's/+//;s/°C//'
# Temperatura de placa/ambiente (acpitz temp1)
sensors \
| awk '/acpitz-acpi-0/ {flag=1} flag && /temp1:/ {print $2; exit}' \
| sed 's/+//;s/°C//'
}
# Leer estado actual
# --- Leer/rotar modo ---
current_mode="cpu"
[[ -f "$STATE_FILE" ]] && current_mode=$(<"$STATE_FILE")
# Cambiar modo si se hizo clic
if [[ "$1" == "click" ]]; then
for i in "${!MODES[@]}"; do
if [[ "${MODES[$i]}" == "$current_mode" ]]; then
next_index=$(( (i + 1) % ${#MODES[@]} ))
echo "${MODES[$next_index]}" > "$STATE_FILE"
next=$(( (i + 1) % ${#MODES[@]} ))
echo "${MODES[$next]}" > "$STATE_FILE"
exit 0
fi
done
fi
# Obtener temperaturas
cpu=$(get_cpu_temp)
igpu=$(get_igpu_temp)
dgpu=$(get_dgpu_temp)
nvme=$(get_nvme_temp)
board=$(get_board_temp)
# --- Obtener todas las temperaturas ---
cpu=$(get_cpu_temp) && cpu=${cpu:-N/A}
igpu=$(get_igpu_temp) && igpu=${igpu:-N/A}
dgpu=$(get_dgpu_temp) && dgpu=${dgpu:-N/A}
nvme=$(get_nvme_temp) && nvme=${nvme:-N/A}
board=$(get_board_temp) && board=${board:-N/A}
cpu=${cpu:-N/A}
igpu=${igpu:-N/A}
dgpu=${dgpu:-N/A}
nvme=${nvme:-N/A}
board=${board:-N/A}
# Definir ícono y valor visible
# --- Escoge qué mostrar según modo ---
case "$current_mode" in
cpu) icon="CPU"; temp="$cpu" ;;
igpu) icon="iGPU"; temp="$igpu" ;;
dgpu) icon="dGPU"; temp="$dgpu" ;;
esac
# Tooltip con \n y escapado correcto
tooltip=$(printf "CPU: %s°C\niGPU: %s°C\ndGPU: %s°C\nNVMe: %s°C\nBoard: %s°C" "$cpu" "$igpu" "$dgpu" "$nvme" "$board")
tooltip_escaped=$(echo "$tooltip" | jq -Rs .)
# --- Tooltip multilínea ---
tooltip=$(printf \
"CPU: %sº\niGPU: %sº\ndGPU: %sº\nNVMe: %sº\nBoard: %sº" \
"$cpu" "$igpu" "$dgpu" "$nvme" "$board")
tooltip_escaped=$(printf "%s" "$tooltip" | jq -Rs .)
# --- Salida JSON para Waybar ---
echo "{\"text\": \"$icon: ${temp}º\", \"tooltip\": ${tooltip_escaped}}"
# Salida final
echo "{\"text\": \"$icon: ${temp}°C\", \"tooltip\": ${tooltip_escaped}}"

View File

@ -29,6 +29,10 @@ window#waybar.hidden {
#custom-weather,
#cpu,
#memory,
#custom-btrfs,
#custom-news,
#custom-mouse_battery,
#custom-headset_battery,
#custom-updtes,
#custom-rate,
#custom-inetspeedup,
@ -54,6 +58,10 @@ window#waybar.hidden {
#mpris {
color: #fa9f8e;
font-size: 15px;
margin-left: 5px;
margin-right: 5px;
border-radius: 8px;
}
#custom-roon {
color: #fa9f8e;
@ -100,6 +108,26 @@ window#waybar.hidden {
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-btrfs {
font-size: 15px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-news {
font-size: 15px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-mouse_battery {
font-size: 14px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-headset_battery {
font-size: 14px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-updates {
font-size: 15px;
color: #81a1c1;
@ -199,6 +227,8 @@ window#waybar.hidden {
#custom-fans,
#power-profiles-daemon,
#memory,
#custom-btrfs,
#custom-news,
#custom-updates,
#custom-tailscale,
#custom-rate,
@ -220,8 +250,8 @@ window#waybar.hidden {
margin-top: 10px;
margin-bottom: 10px;
margin-right: 10px;
margin-right: 5px;
margin-left: 5px;
font-size: 19px;
}
#custom-separator {
@ -233,27 +263,26 @@ window#waybar.hidden {
}
#custom-pwrate {
color: #81a1c1;
padding-left: 10px;
margin-right: 15px;
margin-left: 0px;
margin-right: 10px;
font-size: 13px;
border-radius: 0px 8px 8px 0px;
margin-left: -15px;
border-radius: 8px;
}
#custom-headset_battery {
padding-left: 5px;
padding-right: 5px;
}
#wireplumber {
color: #81a1c1;
padding-left: 10px;
margin-right: 10px;
font-size: 23px;
border-radius: 0px 8px 8px 0px;
margin-left: -15px;
border-radius: 8px;
}
#wireplumber.muted {
color: #fb958b;
padding-left: 10px;
font-size: 23px;
border-radius: 0px 8px 8px 0px;
border-radius: 8px;
}
#backlight {
@ -268,11 +297,8 @@ window#waybar.hidden {
}
#network {
padding-left: 0.2em;
color: #5e81ac;
border-radius: 8px 8px 8px 8px;
padding-left: 12px;
padding-right: 12px;
border-radius: 8px;
font-size: 19px;
}
@ -282,7 +308,7 @@ window#waybar.hidden {
#battery {
color: #81a1c1;
font-size: 19px;
font-size: 14px;
}
#battery.critical,
@ -290,16 +316,16 @@ window#waybar.hidden {
#battery.full,
#battery.plugged {
color: #81a1c1;
font-size: 19px;
font-size: 14px;
}
#battery.charging {
font-size: 19px;
font-size: 14px;
}
#battery.full,
#battery.plugged {
font-size: 19px;
font-size: 14px;
}
@keyframes blink {
@ -336,38 +362,34 @@ window#waybar.hidden {
#bluetooth {
color: #fb958b;
padding-left: 10px;
margin-right: -5px;
margin-left: 0px;
margin-right: 5px;
font-size: 18px;
border-radius: 0px 8px 8px 0px;
margin-left: -5px;
border-radius: 8px;
}
#bluetooth.on {
color: #fb958b;
padding-left: 10px;
margin-right: -5px;
margin-left: 0px;
margin-right: 5px;
font-size: 18px;
border-radius: 0px 8px 8px 0px;
margin-left: -5px;
border-radius: 8px;
}
#bluetooth.connected {
color: #81a1c1;
padding-left: 10px;
margin-right: -5px;
margin-left: 0px;
margin-right: 5px;
font-size: 18px;
border-radius: 0px 8px 8px 0px;
margin-left: -5px;
border-radius: 8px;
}
#bluetooth.off {
color: #8a909e;
padding-left: 10px;
margin-right: -5px;
color: #81a1c1;
margin-left: 0px;
margin-right: 5px;
font-size: 18px;
border-radius: 0px 8px 8px 0px;
margin-left: -5px;
border-radius: 8px;
}
#custom-powermenu {
@ -428,6 +450,8 @@ label:focus {
}
#memory,
#custom-btrfs,
#custom-news,
#custom-updates,
#custom-rate,
#custom-tailscale,
@ -439,9 +463,16 @@ label:focus {
#mpris {
font-size: 15px;
margin-left: 5px;
margin-right: 5px;
border-radius: 8px;
}
#custom-roon {
font-size: 15px;
margin-left: 5px;
margin-right: 5px;
border-radius: 8px;
}
#custom-dmp_nowplaying {
@ -483,73 +514,46 @@ label:focus {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
border-radius: 8px;
}
#custom-weather.sunnyDay {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
border-radius: 8px;
}
#custom-weather.clearNight {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
border-radius: 8px;
}
#custom-weather.cloudyFoggyDay,
#custom-weather.cloudyFoggyNight {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
border-radius: 8px;
}
#custom-weather.rainyDay,
#custom-weather.rainyNight {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
border-radius: 8px;
}
#custom-weather.showyIcyDay,
#custom-weather.snowyIcyNight {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
border-radius: 8px;
}
#custom-weather {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
border-radius: 8px;
}
#custom-network_speed {
color: #8a909e;

596
.config/waybar/style.css_ Normal file
View File

@ -0,0 +1,596 @@
* {
font-family: "Ubuntu Nerd Font", "Font Awesome 6 Pro";
font-size: 15px;
}
window#waybar {
background-color: #242933;
color: #ffffff;
border-radius: 8px;
border-width: 3px;
border-color: #3b4252;
border-style: solid;
}
window#waybar.hidden {
opacity: 0.1;
}
#window {
color: #64727d;
margin-left: 50px;
margin-right: 50px;
margin-top: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#workspaces,
#custom-calendar_clock,
#custom-weather,
#cpu,
#memory,
#custom-btrfs,
#custom-mouse_battery,
#custom-headset_battery,
#custom-updtes,
#custom-rate,
#custom-inetspeedup,
#custom-inetspeeddown,
#tray,
#custom-separator,
#mode,
#custom-lock,
#workspaces,
#idle_inhibitor,
#power-profiles-daemon,
#custom-fans,
#custom-powermenu,
#custom-launcher,
#custom-vpn,
#custom-borg,
#temperature,
#custom-temps,
#cpu {
color: #fa9f8e;
border-radius: 8px 8px 8px 8px;
}
#mpris {
color: #fa9f8e;
}
#custom-roon {
color: #fa9f8e;
}
#custom-dmp_nowplaying {
color: #fa9f8e;
}
#custom-lyrics {
margin-left: 10px;
margin-right: 10px;
}
#image {
margin-left: 10px;
margin-right: 10px;
}
#temperature {
color: #fa9f8e;
border-radius: 8px 8px 8px 8px;
}
#custom-temps {
color: #fa9f8e;
border-radius: 8px 8px 8px 8px;
}
#custom-tailscale {
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#cutom-borg {
color: #fa9f8e;
border-radius: 8px 8px 8px 8px;
}
#power-profiles-daemon {
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-fans {
color: #fa9f8e;
border-radius: 8px 8px 8px 8px;
}
#memory {
font-size: 15px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-btrfs {
font-size: 15px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-mouse_battery {
font-size: 15px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-headset_battery {
font-size: 15px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-updates {
font-size: 15px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-inetspeeddown {
font-size: 15px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
#custom-inetspeedup {
font-size: 15px;
color: #81a1c1;
border-radius: 8px 8px 8px 8px;
}
@keyframes button_activate {
from {
opacity: 0.3;
}
to {
opacity: 1;
}
}
#workspaces button {
border: none;
color: #d4d2a9;
padding: 3px;
background: transparent;
box-shadow: none;
}
#workspaces button.active {
color: #81a1c1;
background: radial-gradient(
circle,
rgba(20, 48, 187, 0.699) 5%,
rgba(36, 39, 54, 0.5) 18%,
rgba(132, 129, 156, 0) 23%,
rgba(70, 76, 98, 0.201) 24%,
rgba(132, 129, 156, 0) 30%
);
animation: button_activate 0.2s ease-in-out;
}
#workspaces button.urgent {
color: #fa9f8e;
}
#workspaces button.persistent {
color: #85909e;
}
#workspaces button:hover {
border: none;
background: radial-gradient(
circle,
rgba(25, 79, 255, 0.1) 20%,
rgba(132, 129, 156, 0) 30%
);
}
#workspaces button.active:hover,
#workspaces button.urgent:hover {
background: inherit;
}
#custom-launcher {
margin-left: 10px;
margin-right: 10px;
padding-right: 5px;
padding-left: 0px;
font-size: 22px;
color: #7a95c9;
margin-top: 1px;
margin-bottom: 1px;
border-radius: 8px 8px 8px 8px;
}
#workspaces,
#custom-calendar_clock,
#custom-weather,
#custom-network_speed,
#cpu,
#custom-song_name,
#custom-vpn,
#custom-borg,
#temperature,
#custom-temps,
#custom-fans,
#power-profiles-daemon,
#memory,
#custom-btrfs,
#custom-mouse_battery,
#custom-headset_battery,
#custom-updates,
#custom-tailscale,
#custom-rate,
#custom-inetspeedup,
#custom-inetspeeddown,
#pulseaudio,
#custom-separator,
#tray #network {
background-color: #3b4252;
padding: 0em 2em;
font-size: 20px;
padding-left: 7.5px;
padding-right: 7.5px;
padding-top: 2px;
padding-bottom: 2px;
margin-top: 10px;
margin-bottom: 10px;
margin-right: 10px;
font-size: 19px;
}
#custom-separator {
color: #1b5e20;
margin: 0 5px;
}
#workspaces {
padding-right: 10px;
}
#custom-pwrate {
color: #81a1c1;
padding-left: 10px;
margin-right: 15px;
font-size: 13px;
border-radius: 0px 8px 8px 0px;
margin-left: -15px;
}
#wireplumber {
color: #81a1c1;
padding-left: 10px;
margin-right: 10px;
font-size: 23px;
border-radius: 0px 8px 8px 0px;
margin-left: -15px;
}
#wireplumber.muted {
color: #fb958b;
padding-left: 10px;
font-size: 23px;
border-radius: 0px 8px 8px 0px;
}
#backlight {
color: #81a1c1;
padding-left: 10px;
padding-right: 10px;
font-size: 24px;
border-radius: 8px 8px 8px 8px;
}
#custom-wf-recorder {
color: #ff0000;
}
#network {
padding-left: 0.2em;
color: #5e81ac;
border-radius: 8px 8px 8px 8px;
padding-left: 12px;
padding-right: 12px;
font-size: 19px;
}
#network.disconnected {
color: #fb958b;
}
#battery {
color: #81a1c1;
font-size: 14px;
}
#battery.critical,
#battery.warning,
#battery.full,
#battery.plugged {
color: #81a1c1;
font-size: 14px;
}
#battery.charging {
font-size: 14px;
}
#battery.full,
#battery.plugged {
font-size: 14px;
}
@keyframes blink {
to {
background-color: rgba(30, 34, 42, 0.5);
color: #abb2bf;
}
}
#battery.warning {
color: #ecd3a0;
}
#battery.critical:not(.charging) {
color: #fb958b;
}
#custom-lock {
color: #ecd3a0;
padding: 0 15px 0 15px;
margin-left: 7px;
margin-top: 7px;
margin-bottom: 7px;
}
#custom-calendar_clock {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#bluetooth {
color: #fb958b;
padding-left: 10px;
margin-right: -5px;
font-size: 18px;
border-radius: 0px 8px 8px 0px;
margin-left: -5px;
}
#bluetooth.on {
color: #fb958b;
padding-left: 10px;
margin-right: -5px;
font-size: 18px;
border-radius: 0px 8px 8px 0px;
margin-left: -5px;
}
#bluetooth.connected {
color: #81a1c1;
padding-left: 10px;
margin-right: -5px;
font-size: 18px;
border-radius: 0px 8px 8px 0px;
margin-left: -5px;
}
#bluetooth.off {
color: #8a909e;
padding-left: 10px;
margin-right: -5px;
font-size: 18px;
border-radius: 0px 8px 8px 0px;
margin-left: -5px;
}
#custom-powermenu {
color: #e78284;
margin-right: 12px;
margin-left: 12px;
border-radius: 8px;
padding: 0 6px 0 6.8px;
margin-top: 7px;
margin-bottom: 7px;
}
tooltip {
font-family: Ubuntu Nerd Font;
border-radius: 8px;
padding: 15px;
background-color: #242933;
}
tooltip label {
font-family: Ubuntu Nerd Font;
padding: 5px;
background-color: #242933;
}
#now_playing > tooltip {
background-color: red;
}
label:focus {
background-color: #242933;
}
#tray {
margin-right: 10px;
margin-top: 10px;
margin-bottom: 10px;
font-size: 30px;
border-radius: 8px 8px 8px 8px;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #242933;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#memory,
#custom-btrfs,
#custom-mouse_battery,
#custom-headset_battery,
#custom-updates,
#custom-rate,
#custom-tailscale,
#custom-inetspeedup,
#custom-inetspeeddown,
#cpu {
font-size: 15px;
}
#mpris {
font-size: 15px;
}
#custom-roon {
font-size: 15px;
}
#custom-dmp_nowplaying {
font-size: 15px;
}
#power-profiles-daemon {
font-size: 15px;
}
#custom-fans {
font-size: 15px;
}
#temperature {
font-size: 15px;
}
#custom-temps {
font-size: 15px;
}
#custom-vpn {
font-size: 15px;
}
#custom-borg {
font-size: 15px;
}
#custom-song_name,
#custom-spotify,
#custom-next,
#custom-pre {
background-color: #3b4252;
font-size: 20px;
padding-right: 6.5px;
margin-top: 10px;
margin-bottom: 10px;
font-weight: bold;
}
#custom-weather.severe {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#custom-weather.sunnyDay {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#custom-weather.clearNight {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#custom-weather.cloudyFoggyDay,
#custom-weather.cloudyFoggyNight {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#custom-weather.rainyDay,
#custom-weather.rainyNight {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#custom-weather.showyIcyDay,
#custom-weather.snowyIcyNight {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#custom-weather {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#custom-network_speed {
color: #8a909e;
font-size: 15px;
font-weight: bold;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 8px 8px 8px 8px;
}
#waybar.info {
background-color: rgba(10, 10, 10, 0.0);
font-family: JetBrainsMonoNL Nerd Font Mono;
font-size: 14px;
}
#submap {
background-color: rgba(10, 10, 10, 0.8);
color: rgba(152, 239, 106, 1);
}