diff --git a/docs/modules/Sys-Info.md b/docs/modules/Sys-Info.md index f2914bf8..d2aeddc7 100644 --- a/docs/modules/Sys-Info.md +++ b/docs/modules/Sys-Info.md @@ -19,8 +19,8 @@ Pango markup is supported. | `interval.temps` | `integer` | `5` | Seconds between refreshing temperature data | | `interval.disks` | `integer` | `5` | Seconds between refreshing disk data | | `interval.network` | `integer` | `5` | Seconds between refreshing network data | -| `label_orientation` | `'horizontal'` or `'vertical'` (shorthand: `'h'` or `'v'`) | `'horizontal'` | Orientation of the labels. | -| `orientation` | `'horizontal'` or `'vertical'` (shorthand: `'h'` or `'v'`) | `'horizontal'` | How the labels are laid out (not the rotation of an individual label). | +| `orientation` | `'horizontal'` or `'vertical'` (shorthand: `'h'` or `'v'`) | `'horizontal'` | Orientation of the labels. | +| `direction` | `'horizontal'` or `'vertical'` (shorthand: `'h'` or `'v'`) | `'horizontal'` | How the labels are laid out (not the rotation of an individual label). |
JSON diff --git a/src/modules/sysinfo.rs b/src/modules/sysinfo.rs index 40c6a02c..4b0966f9 100644 --- a/src/modules/sysinfo.rs +++ b/src/modules/sysinfo.rs @@ -3,8 +3,8 @@ use crate::gtk_helpers::IronbarGtkExt; use crate::modules::{Module, ModuleInfo, ModuleParts, ModuleUpdateEvent, WidgetContext}; use crate::{glib_recv, module_impl, send_async, spawn}; use color_eyre::Result; -use gtk::Label; use gtk::prelude::*; +use gtk::Label; use regex::{Captures, Regex}; use serde::Deserialize; use std::collections::HashMap; @@ -22,9 +22,9 @@ pub struct SysInfoModule { interval: Interval, #[serde(default)] - label_orientation: ModuleOrientation, + orientation: ModuleOrientation, - orientation: Option, + direction: Option, #[serde(flatten)] pub common: Option, @@ -191,9 +191,9 @@ impl Module for SysInfoModule { ) -> Result> { let re = Regex::new(r"\{([^}]+)}")?; - let layout = match self.orientation { + let layout = match self.direction { Some(orientation) => orientation, - None => self.label_orientation, + None => self.orientation, }; let container = gtk::Box::new(layout.into(), 10); @@ -204,7 +204,7 @@ impl Module for SysInfoModule { let label = Label::builder().label(format).use_markup(true).build(); label.add_class("item"); - label.set_angle(self.label_orientation.to_angle()); + label.set_angle(self.orientation.to_angle()); container.add(&label); labels.push(label); diff --git a/test-configs/orientation.corn b/test-configs/orientation.corn index 2fe332be..710dd2a4 100644 --- a/test-configs/orientation.corn +++ b/test-configs/orientation.corn @@ -162,7 +162,7 @@ } { type = "sys_info" - label_orientation = "vertical" + orientation = "vertical" interval.memory = 30 interval.cpu = 1 interval.temps = 5 @@ -176,7 +176,7 @@ } { type = "sys_info" - orientation = "vertical" + direction = "vertical" interval.memory = 30 interval.cpu = 1 interval.temps = 5