feat(hyprlock): update
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
"passthrough": false,
|
||||
"fixed-center": true,
|
||||
"modules-left": ["hyprland/workspaces", "hyprland/window"],
|
||||
"modules-center": ["mpris"],
|
||||
"modules-right": [
|
||||
"cpu",
|
||||
"memory",
|
||||
@@ -21,27 +20,12 @@
|
||||
"battery",
|
||||
"tray",
|
||||
"custom/notification",
|
||||
"custom/power"
|
||||
"custom/power",
|
||||
],
|
||||
"custom/spotify": {
|
||||
"format": " {}",
|
||||
"return-type": "json",
|
||||
"on-click": "playerctl -p spotify play-pause",
|
||||
"on-click-right": "spotifatius toggle-liked",
|
||||
"on-click-middle": "playerctl -p spotify next",
|
||||
"exec": "spotifatius monitor",
|
||||
},
|
||||
"mpris": {
|
||||
"player": "spotify",
|
||||
"dynamic-order": ["artist", "title"],
|
||||
"format": "{player_icon} {dynamic}",
|
||||
"format-paused": "{status_icon} <i>{dynamic}</i>",
|
||||
"status-icons": {
|
||||
"paused": "",
|
||||
},
|
||||
"player-icons": {
|
||||
"default": "",
|
||||
},
|
||||
"format": "{cover_art} {artist} - {title}",
|
||||
"icon-size": 20,
|
||||
"max-length": 40
|
||||
},
|
||||
"hyprland/workspaces": {
|
||||
"on-click": "activate",
|
||||
@@ -138,6 +122,12 @@
|
||||
"on-click": "wlogout -p layer-shell &",
|
||||
"format": "⏻",
|
||||
},
|
||||
"custom/nowplaying": {
|
||||
"exec": "~/.config/waybar/scripts/nowplaying.sh",
|
||||
"interval": 2,
|
||||
"return-type": "json",
|
||||
"on-click": "playerctl play-pause"
|
||||
},
|
||||
"custom/notification": {
|
||||
"escape": true,
|
||||
"exec": "swaync-client -swb",
|
||||
@@ -157,7 +147,7 @@
|
||||
"custom/weather": {
|
||||
"format": "{}",
|
||||
"interval": 600,
|
||||
"exec": "~/.config/waybar/scripts/weather.sh", // or your dotfiles folder if you use stow
|
||||
"exec": "~/.config/hypr/scripts/weather.sh", // or your dotfiles folder if you use stow
|
||||
"return-type": "json",
|
||||
"on-click": "gnome-weather"
|
||||
},
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/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}%"
|
||||
24
waybar/scripts/nowplaying.sh
Executable file
24
waybar/scripts/nowplaying.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
CACHE="$HOME/.cache/waybar-cover.jpg"
|
||||
TMP="$HOME/.cache/waybar-cover.tmp.jpg"
|
||||
|
||||
status=$(playerctl status 2>/dev/null)
|
||||
|
||||
if [ "$status" = "Playing" ]; then
|
||||
artist=$(playerctl metadata artist)
|
||||
title=$(playerctl metadata title)
|
||||
url=$(playerctl metadata mpris:artUrl)
|
||||
|
||||
if [[ "$url" == file://* ]]; then
|
||||
cp "${url#file://}" "$TMP"
|
||||
else
|
||||
curl -sL "$url" -o "$TMP"
|
||||
fi
|
||||
|
||||
mv -f "$TMP" "$CACHE"
|
||||
|
||||
echo "{\"text\": \"$artist - $title\", \"tooltip\": \"$artist - $title\", \"class\": \"playing\", \"alt\": \"$CACHE\"}"
|
||||
else
|
||||
echo "{\"text\": \" \", \"class\": \"stopped\"}"
|
||||
fi
|
||||
@@ -1,102 +0,0 @@
|
||||
#!/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}\"}"
|
||||
@@ -74,6 +74,7 @@ window#waybar {
|
||||
|
||||
#clock,
|
||||
#pulseaudio,
|
||||
#custom-nowplaying,
|
||||
#custom-logo,
|
||||
#custom-power,
|
||||
#custom-spotify,
|
||||
@@ -95,6 +96,14 @@ window#waybar {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
#custom-nowplaying {
|
||||
padding-left: 40px;
|
||||
background-size: 30px 30px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;
|
||||
background-image: url('/home/stereov/.cache/nowplaying-cover.jpg')
|
||||
}
|
||||
|
||||
#mpris.playing {
|
||||
color: #a6e3a1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user