Configurable font support
Use fontconfig to load fonts. Fonts can be added to the `fonts` map in the config, and referenced from individual widgets' configurations for customizability. Fonts default to values "mono" and "sans" if nothing is set.
This commit is contained in:
committed by
Kenny Levinsen
parent
1a62696662
commit
48985c470a
@@ -1,7 +1,10 @@
|
||||
use crate::cmd::Cmd;
|
||||
use crate::color::Color;
|
||||
use crate::widget::WaitContext;
|
||||
use crate::widgets::bar_widget::{BarWidget, BarWidgetImpl};
|
||||
use crate::{
|
||||
fonts::FontRef,
|
||||
widgets::bar_widget::{BarWidget, BarWidgetImpl},
|
||||
};
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
@@ -484,11 +487,12 @@ pub struct PulseAudio {
|
||||
|
||||
impl PulseAudio {
|
||||
pub fn new(
|
||||
font: FontRef,
|
||||
font_size: f32,
|
||||
length: u32,
|
||||
sender: Sender<Cmd>,
|
||||
) -> Result<Box<BarWidget>, ::std::io::Error> {
|
||||
BarWidget::new(font_size, length, move |dirty| {
|
||||
BarWidget::new(font, font_size, length, move |dirty| {
|
||||
let device = PulseAudioSoundDevice::new(move || {
|
||||
*dirty.lock().unwrap() = true;
|
||||
sender.send(Cmd::Draw).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user