mirror of
https://github.com/imgurbot12/rmenu.git
synced 2025-02-12 13:15:07 +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
|
/// Override Applicaiton Theme
|
||||||
#[arg(short = 'C', long)]
|
#[arg(short = 'C', long)]
|
||||||
pub css: Option<String>,
|
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
|
// search settings
|
||||||
/// Override Default Placeholder
|
/// Override Default Placeholder
|
||||||
#[arg(short = 'P', long)]
|
#[arg(short = 'P', long)]
|
||||||
|
@ -186,6 +192,9 @@ impl Into<Options> for OptionArgs {
|
||||||
fn into(self) -> Options {
|
fn into(self) -> Options {
|
||||||
Options {
|
Options {
|
||||||
css: self.css,
|
css: self.css,
|
||||||
|
page_size: self.page_size,
|
||||||
|
page_load: self.page_load,
|
||||||
|
jump_dist: self.jump_dist,
|
||||||
placeholder: self.placeholder,
|
placeholder: self.placeholder,
|
||||||
search_restrict: self.search_restrict,
|
search_restrict: self.search_restrict,
|
||||||
search_min_length: self.search_min_length,
|
search_min_length: self.search_min_length,
|
||||||
|
|
|
@ -88,6 +88,12 @@ pub struct Options {
|
||||||
// base settings
|
// base settings
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub css: Option<String>,
|
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
|
// search settings
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub placeholder: Option<String>,
|
pub placeholder: Option<String>,
|
||||||
|
|
|
@ -27,6 +27,7 @@ plugins:
|
||||||
cache: onlogin
|
cache: onlogin
|
||||||
options:
|
options:
|
||||||
css: ~/.config/rmenu/themes/launchpad.css
|
css: ~/.config/rmenu/themes/launchpad.css
|
||||||
|
page_size: 500
|
||||||
transparent: true
|
transparent: true
|
||||||
window_width: 1200
|
window_width: 1200
|
||||||
window_height: 800
|
window_height: 800
|
||||||
|
|
|
@ -307,6 +307,9 @@ impl Config {
|
||||||
/// Update Configuration from Options Object
|
/// Update Configuration from Options Object
|
||||||
pub fn update(&mut self, options: &Options) -> Result<(), String> {
|
pub fn update(&mut self, options: &Options) -> Result<(), String> {
|
||||||
cfg_replace!(self.css, options.css);
|
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
|
// search settings
|
||||||
cfg_replace!(self.search.placeholder, options.placeholder);
|
cfg_replace!(self.search.placeholder, options.placeholder);
|
||||||
cfg_replace!(self.search.restrict, options.search_restrict);
|
cfg_replace!(self.search.restrict, options.search_restrict);
|
||||||
|
|
Loading…
Reference in a new issue