forked from starship/starship
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Refactor memory_usage module to use module config. (starshi…
…p#515) Also addresses a number of bugs: - the percent sign not displaying correctly on some terminal emulators, including kitty - changing the symbol in the configuration file didn't do anything - swap being shown even if the system didn't have any
- Loading branch information
1 parent
e3f1a76
commit 86bb923
Showing
4 changed files
with
83 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::config::{ModuleConfig, RootModuleConfig, SegmentConfig}; | ||
|
||
use ansi_term::{Color, Style}; | ||
use starship_module_config_derive::ModuleConfig; | ||
|
||
#[derive(Clone, ModuleConfig)] | ||
pub struct MemoryConfig<'a> { | ||
pub show_percentage: bool, | ||
pub show_swap: bool, | ||
pub threshold: i64, | ||
pub symbol: SegmentConfig<'a>, | ||
pub display: SegmentConfig<'a>, | ||
pub style: Style, | ||
pub disabled: bool, | ||
} | ||
|
||
impl<'a> RootModuleConfig<'a> for MemoryConfig<'a> { | ||
fn new() -> Self { | ||
MemoryConfig { | ||
show_percentage: false, | ||
show_swap: true, | ||
threshold: 75, | ||
display: SegmentConfig::default(), | ||
symbol: SegmentConfig::new("🐏 "), | ||
style: Color::White.bold().dimmed(), | ||
disabled: true, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters