mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 07:34:27 +02:00
bug: fix missing default battery layout during refactor
This commit is contained in:
parent
d211c6474c
commit
9068108d0f
@ -178,7 +178,7 @@ lazy_static! {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default layout
|
// Default layouts
|
||||||
pub const DEFAULT_LAYOUT: &str = r##"
|
pub const DEFAULT_LAYOUT: &str = r##"
|
||||||
[[row]]
|
[[row]]
|
||||||
ratio=30
|
ratio=30
|
||||||
@ -204,6 +204,35 @@ pub const DEFAULT_LAYOUT: &str = r##"
|
|||||||
default=true
|
default=true
|
||||||
"##;
|
"##;
|
||||||
|
|
||||||
|
pub const DEFAULT_BATTERY_LAYOUT: &str = r##"
|
||||||
|
[[row]]
|
||||||
|
ratio=30
|
||||||
|
[[row.child]]
|
||||||
|
ratio=2
|
||||||
|
type="cpu"
|
||||||
|
[[row.child]]
|
||||||
|
ratio=1
|
||||||
|
type="battery"
|
||||||
|
[[row]]
|
||||||
|
ratio=40
|
||||||
|
[[row.child]]
|
||||||
|
ratio=4
|
||||||
|
type="mem"
|
||||||
|
[[row.child]]
|
||||||
|
ratio=3
|
||||||
|
[[row.child.child]]
|
||||||
|
type="temp"
|
||||||
|
[[row.child.child]]
|
||||||
|
type="disk"
|
||||||
|
[[row]]
|
||||||
|
ratio=30
|
||||||
|
[[row.child]]
|
||||||
|
type="net"
|
||||||
|
[[row.child]]
|
||||||
|
type="proc"
|
||||||
|
default=true
|
||||||
|
"##;
|
||||||
|
|
||||||
// Config and flags
|
// Config and flags
|
||||||
pub const DEFAULT_CONFIG_FILE_PATH: &str = "bottom/bottom.toml";
|
pub const DEFAULT_CONFIG_FILE_PATH: &str = "bottom/bottom.toml";
|
||||||
|
|
||||||
|
@ -267,7 +267,13 @@ pub fn get_widget_layout(
|
|||||||
Some(r) => r,
|
Some(r) => r,
|
||||||
None => {
|
None => {
|
||||||
// This cannot (like it really shouldn't) fail!
|
// This cannot (like it really shouldn't) fail!
|
||||||
ref_row = toml::from_str::<Config>(DEFAULT_LAYOUT)?.row.unwrap();
|
ref_row = toml::from_str::<Config>(if get_use_battery(matches, config) {
|
||||||
|
DEFAULT_BATTERY_LAYOUT
|
||||||
|
} else {
|
||||||
|
DEFAULT_LAYOUT
|
||||||
|
})?
|
||||||
|
.row
|
||||||
|
.unwrap();
|
||||||
&ref_row
|
&ref_row
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user