mirror of
https://github.com/imgurbot12/rmenu.git
synced 2025-02-12 05:05:06 +01:00
feat: export additional settings to options
This commit is contained in:
parent
ce93df8b51
commit
101f2b8b4d
4 changed files with 19 additions and 0 deletions
|
@ -123,6 +123,12 @@ struct OptionArgs {
|
|||
/// Override Applicaiton Theme
|
||||
#[arg(short = 'C', long)]
|
||||
pub css: Option<String>,
|
||||
#[arg(short = 's', long)]
|
||||
pub page_size: Option<usize>,
|
||||
#[arg(short = 'l', long)]
|
||||
pub page_load: Option<f64>,
|
||||
#[arg(short = 'd', long)]
|
||||
pub jump_dist: Option<usize>,
|
||||
// search settings
|
||||
/// Override Default Placeholder
|
||||
#[arg(short = 'P', long)]
|
||||
|
@ -186,6 +192,9 @@ impl Into<Options> for OptionArgs {
|
|||
fn into(self) -> Options {
|
||||
Options {
|
||||
css: self.css,
|
||||
page_size: self.page_size,
|
||||
page_load: self.page_load,
|
||||
jump_dist: self.jump_dist,
|
||||
placeholder: self.placeholder,
|
||||
search_restrict: self.search_restrict,
|
||||
search_min_length: self.search_min_length,
|
||||
|
|
|
@ -88,6 +88,12 @@ pub struct Options {
|
|||
// base settings
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub css: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub page_size: Option<usize>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub page_load: Option<f64>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub jump_dist: Option<usize>,
|
||||
// search settings
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub placeholder: Option<String>,
|
||||
|
|
|
@ -27,6 +27,7 @@ plugins:
|
|||
cache: onlogin
|
||||
options:
|
||||
css: ~/.config/rmenu/themes/launchpad.css
|
||||
page_size: 500
|
||||
transparent: true
|
||||
window_width: 1200
|
||||
window_height: 800
|
||||
|
|
|
@ -307,6 +307,9 @@ impl Config {
|
|||
/// Update Configuration from Options Object
|
||||
pub fn update(&mut self, options: &Options) -> Result<(), String> {
|
||||
cfg_replace!(self.css, options.css);
|
||||
cfg_replace!(self.page_size, options.page_size, true);
|
||||
cfg_replace!(self.page_load, options.page_load, true);
|
||||
cfg_replace!(self.jump_dist, options.jump_dist, true);
|
||||
// search settings
|
||||
cfg_replace!(self.search.placeholder, options.placeholder);
|
||||
cfg_replace!(self.search.restrict, options.search_restrict);
|
||||
|
|
Loading…
Reference in a new issue