fixes
This commit is contained in:
4
bazzite/waybar/scripts/gpu.sh
Normal file → Executable file
4
bazzite/waybar/scripts/gpu.sh
Normal file → Executable file
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
data=$(nvidia-smi --query-gpu=utilization.gpu,temperature.gpu --format=csv,noheader,nounits 2>/dev/null)
|
||||
if [ -z "$data" ]; then
|
||||
echo '{"text": "N/A", "tooltip": "nvidia-smi not available"}'
|
||||
echo '{"text": "GPU N/A", "tooltip": "nvidia-smi not available"}'
|
||||
exit 0
|
||||
fi
|
||||
usage=$(echo "$data" | cut -d',' -f1 | tr -d ' ')
|
||||
temp=$(echo "$data" | cut -d',' -f2 | tr -d ' ')
|
||||
echo "{\"text\": \"${usage}% ${temp}°C\", \"tooltip\": \"GPU: ${usage}%\\nTemp: ${temp}°C\", \"class\": \"\"}"
|
||||
echo "{\"text\": \"GPU ${usage}% ${temp}°C\", \"tooltip\": \"GPU: ${usage}%\\nTemp: ${temp}°C\", \"class\": \"\"}"
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import glob
|
||||
import json
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
profile_dirs = glob.glob(
|
||||
os.path.expanduser("~/.var/app/org.mozilla.Thunderbird/.thunderbird/*.default-esr")
|
||||
) or glob.glob(
|
||||
os.path.expanduser("~/.thunderbird/*.default-esr")
|
||||
)
|
||||
|
||||
if not profile_dirs:
|
||||
print(json.dumps({"text": "", "tooltip": "No Thunderbird profile found"}))
|
||||
exit()
|
||||
|
||||
db_path = os.path.join(profile_dirs[0], "global-messages-db.sqlite")
|
||||
if not os.path.exists(db_path):
|
||||
print(json.dumps({"text": "", "tooltip": "No message database"}))
|
||||
exit()
|
||||
|
||||
try:
|
||||
conn = sqlite3.connect(f"file:{db_path}?mode=ro&nolock=1", uri=True)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute(
|
||||
"SELECT COUNT(*) FROM messages WHERE jsonAttributes LIKE '%\"read\":false%' OR jsonAttributes LIKE '%\"read\": false%'"
|
||||
)
|
||||
count = cursor.fetchone()[0]
|
||||
conn.close()
|
||||
except Exception:
|
||||
# fallback: try folderStatus
|
||||
try:
|
||||
conn = sqlite3.connect(f"file:{db_path}?mode=ro&nolock=1", uri=True)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("SELECT SUM(numNewMessages) FROM folderlocations WHERE numNewMessages > 0")
|
||||
row = cursor.fetchone()
|
||||
count = row[0] if row and row[0] else 0
|
||||
conn.close()
|
||||
except Exception:
|
||||
count = 0
|
||||
|
||||
if count > 0:
|
||||
print(json.dumps({"text": f" {count}", "tooltip": f"{count} unread emails", "class": "unread"}))
|
||||
else:
|
||||
print(json.dumps({"text": "", "tooltip": "No unread emails"}))
|
||||
0
bazzite/waybar/scripts/weather.sh
Normal file → Executable file
0
bazzite/waybar/scripts/weather.sh
Normal file → Executable file
Reference in New Issue
Block a user