Skip to content

Commit

Permalink
refactor: actually use suggested names this time
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaireNeveu committed Apr 6, 2024
1 parent 9af4135 commit 54aa37b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/modules/Sys-Info.md
Original file line number Diff line number Diff line change
Expand Up @@ -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). |

<details>
<summary>JSON</summary>
Expand Down
12 changes: 6 additions & 6 deletions src/modules/sysinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,9 +22,9 @@ pub struct SysInfoModule {
interval: Interval,

#[serde(default)]
label_orientation: ModuleOrientation,
orientation: ModuleOrientation,

orientation: Option<ModuleOrientation>,
direction: Option<ModuleOrientation>,

#[serde(flatten)]
pub common: Option<CommonConfig>,
Expand Down Expand Up @@ -191,9 +191,9 @@ impl Module<gtk::Box> for SysInfoModule {
) -> Result<ModuleParts<gtk::Box>> {
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);
Expand All @@ -204,7 +204,7 @@ impl Module<gtk::Box> 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);
Expand Down
4 changes: 2 additions & 2 deletions test-configs/orientation.corn
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
}
{
type = "sys_info"
label_orientation = "vertical"
orientation = "vertical"
interval.memory = 30
interval.cpu = 1
interval.temps = 5
Expand All @@ -176,7 +176,7 @@
}
{
type = "sys_info"
orientation = "vertical"
direction = "vertical"
interval.memory = 30
interval.cpu = 1
interval.temps = 5
Expand Down

0 comments on commit 54aa37b

Please sign in to comment.