1
0
Fork 0
forked from wry/wry

theme: add title-font and bar-font settings

This commit is contained in:
Julian Orth 2025-09-17 18:37:13 +02:00
parent 01f9c094ee
commit 035e2972de
14 changed files with 116 additions and 11 deletions

View file

@ -650,6 +650,14 @@ impl ConfigClient {
self.send(&ClientMessage::SetFont { font });
}
pub fn set_bar_font(&self, font: &str) {
self.send(&ClientMessage::SetBarFont { font });
}
pub fn set_title_font(&self, font: &str) {
self.send(&ClientMessage::SetTitleFont { font });
}
pub fn get_font(&self) -> String {
let res = self.send_with_response(&ClientMessage::GetFont);
get_response!(res, String::new(), GetFont { font });

View file

@ -768,6 +768,12 @@ pub enum ClientMessage<'a> {
connector: Connector,
blend_space: BlendSpace,
},
SetBarFont {
font: &'a str,
},
SetTitleFont {
font: &'a str,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -145,6 +145,8 @@ pub fn get_font() -> String {
///
/// Default: `monospace 8`.
///
/// See also [`set_bar_font`] and [`set_title_font`].
///
/// The font name should be specified in [pango][pango] syntax.
///
/// [pango]: https://docs.gtk.org/Pango/type_func.FontDescription.from_string.html
@ -152,7 +154,23 @@ pub fn set_font(font: &str) {
get!().set_font(font)
}
/// Resets the font to the default.
/// Sets the font used by the bar.
///
/// If this function is not called, the font set by [`set_font`] is used. See that
/// function for more details.
pub fn set_bar_font(font: &str) {
get!().set_bar_font(font)
}
/// Sets the font used by window titles.
///
/// If this function is not called, the font set by [`set_font`] is used. See that
/// function for more details.
pub fn set_title_font(font: &str) {
get!().set_title_font(font)
}
/// Resets the fonts to the defaults.
///
/// Currently the default is `monospace 8`.
pub fn reset_font() {