feat: polish buttons in wired-notify theme

This commit is contained in:
oddlama 2023-10-13 02:18:00 +02:00
parent 34d96f6895
commit c19dc452f0
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A

View file

@ -209,7 +209,7 @@
# Each mkProgress includes a button bar. But if no progress is included in a notification, # Each mkProgress includes a button bar. But if no progress is included in a notification,
# those won't be rendered, so we have to define bars for non-progress notifications. # those won't be rendered, so we have to define bars for non-progress notifications.
# (And yes, we need 3 because we cannot have duplicate names or dynamic parents) # (And yes, we need 3 because we cannot have duplicate names or dynamic parents)
++ (mkButtonBar name "${ident}_hint" { ++ (mkButtonBar name "${ident}_hint" 0 {
render_criteria = [ render_criteria = [
(And (extra.render_criteria (And (extra.render_criteria
++ [ ++ [
@ -218,7 +218,7 @@
])) ]))
]; ];
}) })
++ (mkButtonBar name "${ident}_body" { ++ (mkButtonBar name "${ident}_body" (-8) {
render_criteria = [ render_criteria = [
(And (extra.render_criteria (And (extra.render_criteria
++ [ ++ [
@ -228,7 +228,7 @@
])) ]))
]; ];
}) })
++ (mkButtonBar name "${ident}_summary" { ++ (mkButtonBar name "${ident}_summary" 0 {
render_criteria = [ render_criteria = [
(And (extra.render_criteria (And (extra.render_criteria
++ [ ++ [
@ -279,45 +279,92 @@
}); });
} }
] ]
++ (mkButtonBar name "progress_${parent}_text" extra) ++ (mkButtonBar name "progress_${parent}_text" (
/*
ignore bottom end padding
*/
-8
)
extra)
); );
mkButtonBar = name: parent: extra: mkButtonBar = name: parent: yOffset: extra:
map (x: extra // x) [ map (x: extra // x) (lib.flatten [
{ {
name = "${name}_action_0_for_${parent}"; name = "${name}_button_bar_for_${parent}";
parent = "${name}_${parent}"; parent = "${name}_${parent}";
hook = mkHook "BL" "TL"; hook = mkHook "BL" "TL";
offset = mkVec2 0 0; offset = mkVec2 0 yOffset;
render_criteria = [ render_criteria = [
(And (extra.render_criteria (And (extra.render_criteria
++ [ ++ [
(Or [ (Or [
(struct "ActionOther" 0) (struct "ActionOther" 0)
#(struct "ActionOther" 1) (struct "ActionOther" 1)
#(struct "ActionOther" 2) (struct "ActionOther" 2)
#(struct "ActionOther" 3) (struct "ActionOther" 3)
(struct "ActionOther" 4)
(struct "ActionOther" 5)
]) ])
])) ]))
]; ];
params = struct "ButtonBlock" (unnamedStruct { params = struct "TextBlock" (unnamedStruct {
text = "%a"; text = "";
font = "${fonts.monospace.name} Bold ${toString (globalScale * 14)}"; font = "${fonts.monospace.name} ${toString (globalScale * 14)}";
ellipsize = mkLiteral "End"; color = colors.base06;
action = struct "OtherAction" 0; padding = mkPaddingLrBt 0 0 0 0;
text_color = colors.base06; dimensions = mkDimensionsWH 568 568 56 48;
text_color_hovered = colors.base06;
background_color = colors.base01;
background_color_hovered = colors.base02;
border_color = colors.base04;
border_color_hovered = colors.base0F;
border_rounding = globalScale * 0;
border_width = globalScale * 2;
padding = mkPaddingLrBt 12 16 12 0;
dimensions = mkDimensionsWH 144 48 24 24;
}); });
} }
]; (lib.flip map [0 1 2 3 4 5] (
i:
lib.optionalAttrs (i == 0) {
parent = "${name}_button_bar_for_${parent}";
hook = mkHook "TL" "TL";
offset = mkVec2 16 12;
}
// lib.optionalAttrs (i != 0) {
parent = "${name}_action_${toString (i - 1)}_for_${parent}";
hook = mkHook "TR" "TL";
offset = mkVec2 8 0;
}
// {
name = "${name}_action_${toString i}_for_${parent}";
render_criteria = [
(
And (extra.render_criteria
++ [
(struct "ActionOther" i)
])
)
];
params = struct "ButtonBlock" (unnamedStruct {
text = "%a";
font = "${fonts.monospace.name} Bold ${toString (globalScale * 14)}";
ellipsize = mkLiteral "End";
action = struct "OtherAction" i;
text_color = colors.base06;
text_color_hovered = colors.base06;
background_color = colors.base01;
background_color_hovered = colors.base02;
border_color = colors.base04;
border_color_hovered = colors.base0F;
border_rounding = globalScale * 0;
border_width = globalScale * 2;
padding = mkPaddingLrBt 8 8 4 4;
# Technically distribute like below, but we'll just allow more even
# if it breaks when having > 4 max length buttons, because it probably
# never happens and looks a lot better this way.
dimensions = mkDimensionsWH 32 144 24 24;
# dimensions = mkDimensionsWH 32 ((
# 568 /* available width */
# - 2 * 16 /* padding lr */
# - (/* count actions */ 6 - 1) * 8 /* padding between */
# ) / /* count actions */ 6) 24 24;
});
}
))
]);
in in
format.generate "wired.ron" (unnamedStruct { format.generate "wired.ron" (unnamedStruct {
max_notifications = 10; max_notifications = 10;