feat: adds hyprlock

This commit is contained in:
Ahwx 2025-03-31 21:29:24 +02:00
parent 109145a021
commit 07c610ad3a
2 changed files with 170 additions and 0 deletions

View file

@ -0,0 +1,47 @@
{ username, ... }:
{
home.file = {
"/home/${username}/.local/bin/weather.sh" = {
executable = true;
text = ''
#!/usr/bin/env bash
# Get the current city using IP geolocation
CITY=$(curl -s https://ipinfo.io/city 2>/dev/null)
# Check if CITY is retrieved successfully
if [[ -n "$CITY" ]]; then
# Fetch weather info for the detected city from wttr.in
weather_info=$(curl -s "wttr.in/$CITY?format=%c+%C+%t" 2>/dev/null)
# Check if the weather info is valid
if [[ -n "$weather_info" ]]; then
echo "$weather_info"
else
echo "Weather info unavailable for $CITY"
fi
else
echo "Unable to determine your location"
fi
'';
};
"/home/${username}/.local/bin/hyprlock-battery.sh" = {
executable = true;
text = ''
#!/usr/bin/env bash
battery_percentage=$(cat /sys/class/power_supply/*/capacity)
battery_status=$(cat /sys/class/power_supply/*/status)
charging_icon="󱐋"
# Check if the battery is charging
if [ "$battery_status" = "Charging" ]; then
battery_icon="$charging_icon"
fi
# Output the battery percentage and icon
echo "$battery_percentage% $battery_icon"
'';
};
};
}