unify fonts across sway and sxmo

This commit is contained in:
Colin 2023-09-16 14:59:12 +00:00
parent 77906fb58b
commit 61428a5c8b
4 changed files with 68 additions and 21 deletions

View File

@ -107,7 +107,7 @@
"--center --margin 45"
"--no-spacing"
# XXX: font size doesn't seem to take effect (would prefer larger)
"--fn 'Sxmo 14' --line-height 22 --border 3"
"--fn 'monospace 14' --line-height 22 --border 3"
"--bdr '${accent0}'" # border
"--scf '${accent2}' --scb '${accent0}'" # scrollbar
"--tb '${accent0}' --tf '${fg0}'" # title

View File

@ -27,7 +27,7 @@ conky.config = {
default_shade_color = '#beebe5',
default_outline_color = '#beebe5',
font = 'Sxmo:size=8',
font = 'sans-serif:size=8',
use_xft = true,
default_color = '#ffffff',
@ -37,14 +37,14 @@ conky.config = {
-- texeci <interval_sec> <cmd>: run the command periodically, _in a separate thread_ so as not to block rendering
conky.text = [[
${color1}${shadecolor 707070}${font Sxmo:size=50:style=Bold}${alignc}${exec date +"%H:%M"}${font}
${color2}${shadecolor a4d7d0}${font Sxmo:size=20}${alignc}${exec date +"%a %d %b"}${font}
${color1}${shadecolor 707070}${font sans-serif:size=50:style=Bold}${alignc}${exec date +"%H:%M"}${font}
${color2}${shadecolor a4d7d0}${font sans-serif:size=20}${alignc}${exec date +"%a %d %b"}${font}
${color1}${shadecolor}${font Sxmo:size=22:style=Bold}${alignc}${exec @bat@ }${font}
${color1}${shadecolor}${font Sxmo:size=20:style=Bold}${alignc}${texeci 600 @weather@ }${font}
${color1}${shadecolor}${font sans-serif:size=22:style=Bold}${alignc}${exec @bat@ }${font}
${color1}${shadecolor}${font sans-serif:size=20:style=Bold}${alignc}${texeci 600 @weather@ }${font}
${color2}${shadecolor a4d7d0}${font Sxmo:size=16}${alignc}⇅ ${downspeedf wlan0}K/s${font}
${font Sxmo:size=16}${alignc}☵ $memperc%  $cpu%${font}
${color2}${shadecolor a4d7d0}${font sans-serif:size=16}${alignc}⇅ ${downspeedf wlan0}K/s${font}
${font sans-serif:size=16}${alignc}☵ $memperc%  $cpu%${font}
]]

View File

@ -1,15 +1,68 @@
# to preview fonts:
# - `font-manager` (gui)
# - useful to determine official name; codepoint support
{ config, lib, pkgs, ... }:
let
# nerdfonts takes popular open fonts and patches them to support a wider range of glyphs, notably emoji.
# any nerdfonts font includes icons such as these:
# - 󱊥 (battery charging)
# - 󰃝 (brightness)
# -  (gps / crosshairs)
# - 󰎈 (music note)
# - 󰍦 (message bubble)
# - 󰏲 (phone)
# -  (weather/sun-behind-clouds)
# used particularly by sxmo utilities, but also a few of my own (e.g. conky)
#
# nerdfonts is very heavy. each font is 20-900 MiB (2 MiB per "variation")
# lots of redundant data inside there, but no deduplication except whatever nix or the fs does implicitly.
wantedNerdfonts = [
# used explicitly by SXMO
# "DejaVuSansMono" # 25 MiB
# good terminal/coding font. grab via nerdfonts for more emoji/unicode support
"Hack" # 26 MiB
"Noto" # 861 MiB
];
nerdfontPkgs = builtins.map
(f: pkgs.nerdfonts.override { fonts = [ f ]; })
wantedNerdfonts;
in
{
fonts = lib.mkIf config.sane.programs.fontconfig.enabled {
fontconfig.enable = true;
fontconfig.defaultFonts = {
emoji = [ "Font Awesome 6 Free" "Noto Color Emoji" ];
monospace = [ "Hack" ];
serif = [ "DejaVu Serif" ];
sansSerif = [ "DejaVu Sans" ];
emoji = [
"Noto Color Emoji"
"Font Awesome 6 Free"
"Font Awesome 6 Brands"
];
monospace = [
"Hack Nerd Font Propo"
# "DejaVuSansM Nerd Font Propo"
"NotoMono Nerd Font Propo"
];
serif = [
"NotoSerif Nerd Font"
"DejaVu Serif"
];
sansSerif = [
"NotoSans Nerd Font"
"DejaVu Sans"
];
};
#vvv enables dejavu_fonts, freefont_ttf, gyre-fonts, liberation_ttf, unifont, noto-fonts-emoji
enableDefaultPackages = true;
packages = with pkgs; [ font-awesome noto-fonts-emoji hack-font ];
enableDefaultPackages = false;
packages = with pkgs; [
# TODO: reduce this font set.
# - probably need only one of dejavu/freefont/liberation
dejavu_fonts # 10 MiB; DejaVu {Sans,Serif,Sans Mono,Math TeX Gyre}; also available as a NerdFonts (Sans Mono only)
font-awesome # 2 MiB; Font Awesome 6 {Free,Brands}
freefont_ttf # 11 MiB; Free{Mono,Sans,Serif}
gyre-fonts # 4 MiB; Tex Gyre *; ttf substitutes for standard PostScript fonts
# hack-font # 1 MiB; Hack; also available as a NerdFonts
liberation_ttf # 4 MiB; Liberation {Mono,Sans,Serif}; also available as a NerdFonts
noto-fonts-color-emoji # 10 Mib; Noto Color Emoji
unifont # 16 MiB; Unifont; provides LOTS of unicode coverage
] ++ nerdfontPkgs;
};
}

View File

@ -209,7 +209,7 @@ in
# - `bindsym $mod+Shift+p exec sxmo_appmenu.sh sys`
# - `input * xkb_options compose:ralt`
# these could be added, but i don't see much benefit.
font = "Sxmo 10";
font = "pango:monospace 10";
mod = "Mod1"; # prefer Alt
xwayland = false; # disable to reduce RAM usage.
workspace_layout = "tabbed";
@ -282,12 +282,6 @@ in
security.doas.enable = true;
security.doas.wheelNeedsPassword = false;
# TODO: nerdfonts is 4GB. it accepts an option to ship only some fonts: probably want to use that.
# sxmo needs nerdfonts for:
# - waybar icons
# - dmenu/bemenu icons
fonts.packages = [ pkgs.nerdfonts ];
# lightdm-mobile-greeter: "The name org.a11y.Bus was not provided by any .service files"
services.gnome.at-spi2-core.enable = true;