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,123 @@
{ pkgs, username, ... }:
{
imports = [ (import ./scripts.nix) ];
home.packages = with pkgs; [
hyprlock
];
home.file = {
"/home/${username}/.config/hypr/hyprlock.conf" = {
executable = false;
text = ''
# GENERAL
general {
no_fade_in = true
grace = 1
disable_loading_bar = false
hide_cursor = true
ignore_empty_input = true
text_trim = true
}
#BACKGROUND
background {
monitor =
path = screenshot
blur_passes = 2
contrast = 0.8916
brightness = 0.7172
vibrancy = 0.1696
vibrancy_darkness = 0
}
# TIME HR
label {
monitor =
text = cmd[update:1000] echo -e "$(date +"%H")"
color = rgba(255, 255, 255, 1)
shadow_pass = 2
shadow_size = 3
shadow_color = rgb(0,0,0)
shadow_boost = 1.2
font_size = 150
# font_family = JetBrains Mono Nerd Font Mono ExtraBold
font_family = AlfaSlabOne
position = 0, -250
halign = center
valign = top
}
# TIME
label {
monitor =
text = cmd[update:1000] echo -e "$(date +"%M")"
# color = 0xff$color0
color = rgba(255, 255, 255, 1)
font_size = 150
# font_family = JetBrains Mono Nerd Font Mono ExtraBold
font_family = AlfaSlabOne
position = 0, -420
halign = center
valign = top
}
# DATE
label {
monitor =
text = cmd[update:1000] echo -e "$(date +"%d %b %A")"
color = rgba(255, 255, 255, 1)
font_size = 14
font_family = JetBrains Mono Nerd Font Mono ExtraBold
position = 0, -130
halign = center
valign = center
}
# WEATHER
label {
monitor =
text = cmd[update:1000] echo "$(bash /home/${username}/.local/bin/weather.sh)"
color = rgba(255, 255, 255, 1)
font_size = 10
font_family = JetBrains Mono Nerd Font Mono ExtraBold
position = 0, 465
halign = center
valign = center
}
# INPUT FIELD
input-field {
monitor =
size = 250, 60
outline_thickness = 0
outer_color = rgba(0, 0, 0, 1)
dots_size = 0.1 # Scale of input-field height, 0.2 - 0.8
dots_spacing = 1 # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true
inner_color = rgba(0, 0, 0, 1)
font_color = rgba(200, 200, 200, 1)
fade_on_empty = false
font_family = JetBrains Mono Nerd Font Mono
placeholder_text = <span foreground="##cdd6f4"> $USER</span>
hide_input = false
position = 0, -470
halign = center
valign = center
zindex = 10
}
# Information
label {
monitor =
text = cmd[update:1000] echo -e "$(/home/${username}/.local/bin/hyprlock-battery.sh)"
color = rgba(255, 255, 255, 1)
font_size = 12
font_family = JetBrains Mono Nerd Font Mono ExtraBold
position = -20, -510
halign = right
valign = center
}
'';
};
};
}

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"
'';
};
};
}