Skip to main content

max / alloy

4.6 KB · 98 lines History Blame Raw
1 @{! variants = default, night }
2 # Alloy swaylock configuration
3 #
4 # v0 lockscreen per docs/STACK.md#lock. The bespoke egui lockscreen
5 # is the first marquee design-system app (v1 target); this config is
6 # what ships until then.
7 #
8 # Bound in the sway config as Mod+Ctrl+L. No image — surface color from the
9 # palette so the transition into lock reads as chrome, not media.
10
11 daemonize
12 ignore-empty-password
13 show-failed-attempts
14 indicator-caps-lock
15
16 # -------------------------------------------------------------------
17 # Colors
18 # -------------------------------------------------------------------
19 # swaylock's native format is `rrggbbaa`: bare, and with the alpha always
20 # written. There is no `#` form and no way to leave the alpha off, which is why
21 # every value here goes through `hex_alpha` rather than rendering as a plain
22 # color. Opaque is 1.0.
23 color=@{hex_alpha(surface.page, 1.0)}
24 inside-color=@{hex_alpha(surface.raised, 1.0)}
25 inside-clear-color=@{hex_alpha(surface.raised, 1.0)}
26 inside-caps-lock-color=@{hex_alpha(surface.raised, 1.0)}
27 inside-ver-color=@{hex_alpha(surface.raised, 1.0)}
28 inside-wrong-color=@{hex_alpha(surface.raised, 1.0)}
29
30 # The ring is the whole affordance, so it is `border.strong` and not the raw
31 # `line.border` this file used to take. That was 1.37:1 against the page on Akari
32 # Dawn: a smudge on a cream field, with nothing to say a password was wanted.
33 # `border.strong` is 3.27:1 on dawn and 8.15:1 on night. swaylock cannot draw a
34 # prompt (`--show-keyboard-layout` is documented "while typing", so there is no
35 # text at rest), which leaves making the ring obviously a control as the only
36 # lever there is.
37 ring-color=@{hex_alpha(border.strong, 1.0)}
38 ring-clear-color=@{hex_alpha(status.warning, 1.0)}
39 ring-caps-lock-color=@{hex_alpha(status.warning, 1.0)}
40 ring-ver-color=@{hex_alpha(status.info, 1.0)}
41 ring-wrong-color=@{hex_alpha(status.danger, 1.0)}
42
43 line-color=@{hex_alpha(border.subtle, 1.0)}
44 line-clear-color=@{hex_alpha(border.subtle, 1.0)}
45 line-caps-lock-color=@{hex_alpha(border.subtle, 1.0)}
46 line-ver-color=@{hex_alpha(border.subtle, 1.0)}
47 line-wrong-color=@{hex_alpha(border.subtle, 1.0)}
48
49 text-color=@{hex_alpha(content.primary, 1.0)}
50 text-clear-color=@{hex_alpha(content.primary, 1.0)}
51 text-caps-lock-color=@{hex_alpha(content.primary, 1.0)}
52 text-ver-color=@{hex_alpha(content.primary, 1.0)}
53 text-wrong-color=@{hex_alpha(content.primary, 1.0)}
54
55 # One keypress draws one segment on the ring, so these are the only feedback
56 # that typing is registering at all.
57 #
58 # `surface.page`, not the amber this file used to take. Amber against
59 # `border.strong` is 1.17:1 — the segments would have disappeared into the very
60 # ring the line above just made visible. Only tokens that invert with polarity
61 # can contrast with a border tone that itself inverts, which is what rules the
62 # accents out here. Against the page tone the segments run 3.27:1 (dawn) to
63 # 8.15:1 (night), and they stay legible against every state the ring can take:
64 # worst case 2.80:1 on dawn with caps on.
65 #
66 # Caps lock keeps the same segment color deliberately. The *ring* turns amber and
67 # the caps text appears, which is where that state belongs; recoloring the
68 # segments too would trade legible feedback for a signal already being sent.
69 key-hl-color=@{hex_alpha(surface.page, 1.0)}
70 caps-lock-key-hl-color=@{hex_alpha(surface.page, 1.0)}
71 # Backspace stays the error tone, and reads against the segments it eats at
72 # 8.07:1 (dawn) and 3.72:1 (night).
73 bs-hl-color=@{hex_alpha(status.danger, 1.0)}
74 caps-lock-bs-hl-color=@{hex_alpha(status.danger, 1.0)}
75
76 # The lines dividing one keypress's segment from the next, and the reason this
77 # file was worth revisiting: it was `00000000`, fully transparent, inherited from
78 # the hand-written original. With no divider, consecutive keystrokes merge into a
79 # single growing arc, so the ring showed roughly how much had been typed and
80 # never how many. Ink against the page-toned segments is 13.25:1 (dawn) and
81 # 11.77:1 (night), which makes each keypress a countable notch.
82 separator-color=@{hex_alpha(content.primary, 1.0)}
83
84 # -------------------------------------------------------------------
85 # Layout
86 # -------------------------------------------------------------------
87 indicator-radius=90
88 # Thicker than the 6 it was. The ring now carries three things that have to be
89 # told apart at a glance — its own base tone, a segment per keypress, and a
90 # divider between segments — and six pixels is not much to divide three ways.
91 indicator-thickness=10
92 # The ring is drawn before anything is typed. Without this the lock is a blank
93 # field until you touch a key, which is the state that reads as "asleep" rather
94 # than "locked and waiting".
95 indicator-idle-visible
96 font=Quasi Mono
97 font-size=16
98