change hyprlock config

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-08-17 22:24:34 +02:00
parent f56bf4402c
commit 8654da046c
+124 -42
View File
@@ -1,5 +1,65 @@
{config, ...}: let
{
config,
lib,
pkgs,
...
}: let
c = config.lib.stylix.colors;
font = config.stylix.fonts.monospace.name;
fontSize = 16;
em = fontSize * 4.0 / 3.0;
charW = em * 0.6;
lineH = em * 1.32;
round = x: builtins.floor (x + 0.5);
px = x: toString (round x);
paint = color: t: ''<span foreground="#${color}">${t}</span>'';
fromFile = name: text: ''cmd[update:0] cat ${pkgs.writeText name text}'';
inner = 42;
width = inner + 2;
valueCol = 13;
spaces = n: lib.concatStrings (lib.genList (_: " ") n);
border = paint c.base0D;
hbar = lib.concatStrings (lib.genList (_: "") inner);
row = content: border "" + content + border "";
blank = row (spaces inner);
entry = name: value: let
prompt = " ${name}:";
gap = spaces (valueCol - builtins.stringLength prompt);
tail = spaces (inner - valueCol - builtins.stringLength value);
in
row (border prompt + gap + paint c.base05 value + tail);
lines = [
(border "${hbar}")
blank
(entry "Session" "Hyprland")
(entry "Username" config.home.username)
(entry "Password" "")
blank
(border "${hbar}")
];
rowY = i: -((i + 0.5) - (builtins.length lines) / 2.0) * lineH;
colX = i: (i - width / 2.0) * charW;
frameHalfH = (builtins.length lines) * lineH / 2.0;
outsideY = frameHalfH + 1.5 * lineH;
inputH = fontSize / 0.8;
inputW = 27 * charW;
dotPad = (inputH - lineH) / 2.0;
inputX = colX (valueCol + 1) - dotPad;
passwordRow = 4;
hidden = "<span> </span>";
in {
stylix.targets.hyprlock.enable = false;
@@ -16,65 +76,87 @@ in {
label = [
{
monitor = "";
text = ''cmd[update:0] echo "[$USER@$(hostname) ~]"'';
color = "rgb(${c.base0D})";
font_size = 13;
font_family = config.stylix.fonts.monospace.name;
position = "48, -48";
halign = "left";
valign = "top";
}
{
monitor = "";
text = ''cmd[update:1000] echo "$(date +'%H:%M:%S')"'';
text = ''cmd[update:1000] date +"%H:%M %A %d %B"'';
color = "rgb(${c.base05})";
font_size = 13;
font_family = config.stylix.fonts.monospace.name;
position = "48, -70";
halign = "left";
font_size = fontSize;
font_family = font;
position = "0, -64";
halign = "center";
valign = "top";
}
{
monitor = "";
text = ''cmd[update:60000] echo "$(date +'%A %d %B %Y')"'';
text = "Welcome";
color = "rgb(${c.base05})";
font_size = fontSize;
font_family = font;
position = "0, ${px outsideY}";
halign = "center";
valign = "center";
}
{
monitor = "";
text = fromFile "hyprlock-frame" (lib.concatStringsSep "\n" lines);
color = "rgb(${c.base05})";
font_size = fontSize;
font_family = font;
text_align = "left";
position = "0, 0";
halign = "center";
valign = "center";
}
{
monitor = "";
text = "<span> </span>$FAIL<span> </span>";
color = "rgb(${c.base08})";
font_size = fontSize;
font_family = font;
position = "0, ${px (-outsideY)}";
halign = "center";
valign = "center";
}
{
monitor = "";
text =
fromFile "hyprlock-hints"
"${paint c.base0D "Enter"} ${paint c.base04 "unlock"} ${paint c.base0D "Esc"} ${paint c.base04 "clear"}";
color = "rgb(${c.base04})";
font_size = 13;
font_family = config.stylix.fonts.monospace.name;
position = "48, -92";
halign = "left";
valign = "top";
}
{
monitor = "";
text = "passwd:";
color = "rgb(${c.base0D})";
font_size = 13;
font_family = config.stylix.fonts.monospace.name;
position = "48, -141";
halign = "left";
valign = "top";
font_size = fontSize;
font_family = font;
position = "0, 40";
halign = "center";
valign = "bottom";
}
];
"input-field" = [
{
monitor = "";
size = "200, 20";
size = "${px inputW}, ${px inputH}";
position = "${px (inputX + inputW / 2.0)}, ${px (rowY passwordRow)}";
halign = "center";
valign = "center";
outline_thickness = 0;
outer_color = "rgba(00000000)";
inner_color = "rgba(00000000)";
font_color = "rgb(${c.base05})";
fade_on_empty = false;
placeholder_text = "";
hide_input = true;
rounding = 0;
check_color = "rgb(${c.base0B})";
fade_on_empty = false;
font_family = font;
font_color = "rgb(${c.base05})";
dots_text_format = "*";
dots_size = 0.8;
dots_spacing = 0.0;
dots_center = false;
swap_font_color = true;
placeholder_text = hidden;
fail_text = hidden;
check_color = "rgb(${c.base0C})";
fail_color = "rgb(${c.base08})";
fail_text = ''<span font_desc="${config.stylix.fonts.monospace.name} 13">auth failed</span>'';
capslock_color = "rgb(${c.base0A})";
position = "116, -138";
halign = "left";
valign = "top";
}
];
};