1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 23:01:04 +02:00

feat: Add orientation support for custom label and button

This commit is contained in:
Claire Neveu 2024-04-04 16:12:45 -04:00
parent 702b0a63bf
commit 70b2c592b2
11 changed files with 145 additions and 39 deletions

View file

@ -113,17 +113,6 @@ pub fn set_length<W: WidgetExt>(widget: &W, length: i32, bar_orientation: Orient
};
}
/// Attempts to parse an `Orientation` from `String`.
/// Will accept `horizontal`, `vertical`, `h` or `v`.
/// Ignores case.
fn try_get_orientation(orientation: &str) -> Result<Orientation> {
match orientation.to_lowercase().as_str() {
"horizontal" | "h" => Ok(Orientation::Horizontal),
"vertical" | "v" => Ok(Orientation::Vertical),
_ => Err(Report::msg("Invalid orientation string in config")),
}
}
impl WidgetOrModule {
fn add_to(self, parent: &gtk::Box, context: &CustomWidgetContext, common: CommonConfig) {
match self {