Skip to content

Commit

Permalink
i3/sway: support str type for font size
Browse files Browse the repository at this point in the history
  • Loading branch information
DCsunset authored and rycee committed Sep 6, 2024
1 parent 7d56985 commit 127ccc3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/services/window-managers/i3-sway/lib/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let
};

size = mkOption {
type = types.float;
type = types.either types.float types.str;
default = 8.0;
description = ''
The font size to use for window titles.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
enable = true;

config = {
bars = [{ fonts = [ "FontAwesome" "Iosevka 11.500000" ]; }];
bars = [
{ fonts = [ "FontAwesome" "Iosevka 11.500000" ]; }
{ fonts = [ "FontAwesome" "Iosevka Bold Semi-Condensed 14px" ]; }
];
fonts = [ "DejaVuSansMono" "Terminus Bold Semi-Condensed 13.500000" ];
};
};
Expand All @@ -21,5 +24,6 @@
test.asserts.warnings.expected = [
"Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead."
"Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead."
"Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead."
];
}
22 changes: 22 additions & 0 deletions tests/modules/services/window-managers/i3/i3-fonts-expected.conf
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,25 @@ bar {
}
}

bar {
font pango:FontAwesome, Iosevka Bold Semi-Condensed 14px
mode dock
hidden_state hide
position bottom
status_command @i3status@/bin/i3status
i3bar_command @i3@/bin/i3bar
workspace_buttons yes
strip_workspace_numbers no
tray_output primary
colors {
background #000000
statusline #ffffff
separator #666666
focused_workspace #4c7899 #285577 #ffffff
active_workspace #333333 #5f676a #ffffff
inactive_workspace #333333 #222222 #888888
urgent_workspace #2f343a #900000 #ffffff
binding_mode #2f343a #900000 #ffffff
}
}

21 changes: 15 additions & 6 deletions tests/modules/services/window-managers/i3/i3-fonts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@
enable = true;

config = {
bars = [{
fonts = {
names = [ "FontAwesome" "Iosevka" ];
size = 11.5;
};
}];
bars = [
{
fonts = {
names = [ "FontAwesome" "Iosevka" ];
size = 11.5;
};
}
{
fonts = {
names = [ "FontAwesome" "Iosevka" ];
style = "Bold Semi-Condensed";
size = "14px";
};
}
];
fonts = {
names = [ "DejaVuSansMono" "Terminus" ];
style = "Bold Semi-Condensed";
Expand Down

0 comments on commit 127ccc3

Please sign in to comment.