feat(hyprlock): update
This commit is contained in:
@@ -13,6 +13,7 @@ exec-once = swww-daemon
|
||||
exec-once = swaync
|
||||
exec-once = sh -c "/home/stereov/.local/share/JetBrains/Toolbox/bin/jetbrains-toolbox %u & sleep 6 && hyprctl dispatch closewindow class:jetbrains-toolbox"
|
||||
exec-once = "/home/stereov/Developer/antistereov/randrwall/randrwall.py reload"
|
||||
exec-once = ~/.config/hypr/scripts/cover-listener.sh
|
||||
|
||||
exec-once = gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3-dark'
|
||||
exec-once = gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||
|
||||
@@ -51,7 +51,7 @@ label {
|
||||
# BATTERY
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo "$(~/.config/waybar/scripts/battery.sh)"
|
||||
text = cmd[update:1000] echo "$(~/.config/hypr/scripts/battery.sh)"
|
||||
font_family = lexend
|
||||
font_size = 14
|
||||
position = -100, 100
|
||||
@@ -59,9 +59,10 @@ label {
|
||||
valign = bottom
|
||||
}
|
||||
|
||||
# WEATHER
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:600000] echo "$(~/.config/waybar/scripts/weather.sh | jq -r .text)"
|
||||
text = cmd[update:600000] echo "$(~/.config/hypr/scripts/weather.sh | jq -r .text)"
|
||||
font_family = lexend
|
||||
font_size = 14
|
||||
position = -200, 100
|
||||
@@ -69,6 +70,41 @@ label {
|
||||
valign = bottom
|
||||
}
|
||||
|
||||
# NOW PLAYING
|
||||
image {
|
||||
monitor =
|
||||
path = ~/.cache/nowplaying-cover.jpg
|
||||
size = 250
|
||||
rounding = 20
|
||||
position = 0, -120
|
||||
halign = center
|
||||
valign = center
|
||||
border_size = 0
|
||||
reload_time = 1
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] playerctl metadata artist
|
||||
color = rgba(242, 243, 244, 0.8)
|
||||
font_size = 14
|
||||
font_family = Lexend Bold
|
||||
position = 0, -300
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] playerctl metadata title
|
||||
color = rgba(242, 243, 244, 0.8)
|
||||
font_size = 14
|
||||
font_family = Lexend
|
||||
position = 0, -270
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
|
||||
input-field {
|
||||
monitor =
|
||||
size = 300, 50
|
||||
@@ -88,7 +124,7 @@ input-field {
|
||||
check_color = $check_color
|
||||
fail_text = <i>$FAIL ($ATTEMPTS)</i>
|
||||
|
||||
rounding = 60
|
||||
rounding = 15
|
||||
shadow_passes = 0
|
||||
fade_on_empty = false
|
||||
}
|
||||
|
||||
55
hypr/scripts/battery.sh
Executable file
55
hypr/scripts/battery.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Find battery + AC device (works on most laptops)
|
||||
BAT="$(ls -1 /sys/class/power_supply 2>/dev/null | grep -E '^BAT|^CMB|^BATT' | head -n1 || true)"
|
||||
AC="$(ls -1 /sys/class/power_supply 2>/dev/null | grep -E '^AC|^ADP|^ACAD' | head -n1 || true)"
|
||||
|
||||
if [[ -z "${BAT}" ]]; then
|
||||
echo " --%" # unknown
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BAT_PATH="/sys/class/power_supply/${BAT}"
|
||||
STATUS="$(<"${BAT_PATH}/status")" # Charging|Discharging|Full|Not charging|Unknown
|
||||
CAPACITY="$(<"${BAT_PATH}/capacity")" # 0-100
|
||||
|
||||
# 0-10, 11-35, 36-60, 61-85, 86-100
|
||||
if ((CAPACITY <= 10)); then
|
||||
if [[ "${STATUS}" == "Charging" ]]; then
|
||||
ICON=" "
|
||||
else
|
||||
ICON=" "
|
||||
fi
|
||||
elif ((CAPACITY <= 30)); then
|
||||
if [[ "${STATUS}" == "Charging" ]]; then
|
||||
ICON=" "
|
||||
else
|
||||
ICON=" "
|
||||
fi
|
||||
elif ((CAPACITY <= 60)); then
|
||||
if [[ "${STATUS}" == "Charging" ]]; then
|
||||
ICON=" "
|
||||
else
|
||||
ICON=" "
|
||||
fi
|
||||
elif ((CAPACITY <= 80)); then
|
||||
if [[ "${STATUS}" == "Charging" ]]; then
|
||||
ICON=" "
|
||||
else
|
||||
ICON=" "
|
||||
fi
|
||||
else
|
||||
if [[ "${STATUS}" == "Charging" ]]; then
|
||||
ICON=" "
|
||||
else
|
||||
ICON=" "
|
||||
fi
|
||||
fi
|
||||
|
||||
# If full, show a nicer indicator
|
||||
if [[ "${STATUS}" == "Full" ]]; then
|
||||
CHG_IND=" " # nf-fa-check
|
||||
fi
|
||||
|
||||
echo "${ICON} ${CAPACITY}%"
|
||||
5
hypr/scripts/cover-listener.sh
Executable file
5
hypr/scripts/cover-listener.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
playerctl metadata --follow --format "{{mpris:artUrl}}" | while read -r _; do
|
||||
~/.config/hypr/scripts/cover.sh
|
||||
done
|
||||
15
hypr/scripts/cover.sh
Executable file
15
hypr/scripts/cover.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
CACHE="$HOME/.cache/nowplaying-cover.jpg"
|
||||
|
||||
url=$(playerctl metadata mpris:artUrl 2>/dev/null)
|
||||
|
||||
# Kein Player aktiv
|
||||
[ -z "$url" ] && exit 0
|
||||
|
||||
# file:// prefix entfernen (Spotify lokal)
|
||||
if [[ "$url" == file://* ]]; then
|
||||
cp "${url#file://}" "$CACHE"
|
||||
else
|
||||
curl -sL "$url" -o "$CACHE"
|
||||
fi
|
||||
11
hypr/scripts/nowplaying.sh
Executable file
11
hypr/scripts/nowplaying.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
status=$(playerctl status 2>/dev/null)
|
||||
|
||||
if [ "$status" = "Playing" ]; then
|
||||
artist=$(playerctl metadata artist)
|
||||
title=$(playerctl metadata title)
|
||||
echo "$artist - $title"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
102
hypr/scripts/weather.sh
Executable file
102
hypr/scripts/weather.sh
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
# --- CONFIGURATION ---
|
||||
LAT="51.0509" # Replace with your Latitude
|
||||
LON="13.7383" # Replace with your Longitude
|
||||
UNITS="metric" # Use "metric" for Celsius, "imperial" for Fahrenheit
|
||||
TZ="Europe/Berlin"
|
||||
# ---------------------
|
||||
|
||||
if [[ "$UNITS" == "metric" ]]; then
|
||||
TEMP_UNIT="celsius"
|
||||
LABEL="°C"
|
||||
else
|
||||
TEMP_UNIT="fahrenheit"
|
||||
LABEL="°F"
|
||||
fi
|
||||
|
||||
# Fetch the weather data
|
||||
RESPONSE=$(curl -s "https://api.open-meteo.com/v1/forecast?latitude=${LAT}&longitude=${LON}¤t=temperature_2m,weather_code,is_day&timezone=${TZ}")
|
||||
|
||||
# Check if curl failed to get a response
|
||||
if [ -z "$RESPONSE" ]; then
|
||||
echo "No connection"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEMP=$(echo "$RESPONSE" | jq -r '.current.temperature_2m | round')
|
||||
CODE=$(echo "$RESPONSE" | jq -r '.current.weather_code')
|
||||
IS_DAY=$(echo "$RESPONSE" | jq -r '.current.is_day')
|
||||
|
||||
case "$CODE" in
|
||||
0)
|
||||
if [[ "$IS_DAY" == "1" ]]; then
|
||||
ICON=" " # nf-weather-day_sunny
|
||||
else
|
||||
ICON=" " # nf-weather-night_clear
|
||||
fi
|
||||
DESC="Clear sky"
|
||||
;;
|
||||
1 | 2)
|
||||
if [[ "$IS_DAY" == "1" ]]; then
|
||||
ICON=" " # nf-weather-day_cloudy
|
||||
else
|
||||
ICON=" " # nf-weather-night_alt_cloudy
|
||||
fi
|
||||
DESC="Partly cloudy"
|
||||
;;
|
||||
3)
|
||||
ICON=" " # nf-weather-cloudy
|
||||
DESC="Overcast"
|
||||
;;
|
||||
45 | 48)
|
||||
ICON=" " # nf-weather-fog
|
||||
DESC="Fog"
|
||||
;;
|
||||
51 | 53 | 55)
|
||||
ICON=" " # nf-weather-sprinkle
|
||||
DESC="Drizzle"
|
||||
;;
|
||||
56 | 57)
|
||||
ICON=" "
|
||||
DESC="Freezing drizzle"
|
||||
;;
|
||||
61 | 63 | 65)
|
||||
ICON=" " # nf-weather-rain
|
||||
DESC="Rain"
|
||||
;;
|
||||
66 | 67)
|
||||
ICON=" "
|
||||
DESC="Freezing rain"
|
||||
;;
|
||||
71 | 73 | 75 | 77)
|
||||
ICON=" " # nf-weather-snow
|
||||
DESC="Snow"
|
||||
;;
|
||||
80 | 81 | 82)
|
||||
ICON=" " # nf-weather-showers
|
||||
DESC="Rain showers"
|
||||
;;
|
||||
85 | 86)
|
||||
ICON=" "
|
||||
DESC="Snow showers"
|
||||
;;
|
||||
95)
|
||||
ICON=" " # nf-weather-thunderstorm
|
||||
DESC="Thunderstorm"
|
||||
;;
|
||||
96 | 99)
|
||||
ICON=" "
|
||||
DESC="Thunderstorm with hail"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Determine unit label
|
||||
if [ "$UNITS" = "metric" ]; then
|
||||
LABEL="°C"
|
||||
else
|
||||
LABEL="°F"
|
||||
fi
|
||||
|
||||
# Final JSON output for Waybar
|
||||
echo "{\"text\": \"${ICON} ${TEMP}${LABEL}\", \"tooltip\": \"${DESC}\"}"
|
||||
Reference in New Issue
Block a user