big overhaul

This commit is contained in:
djaidjai committed 2023-05-09 13:41:54 +02:00
1 parent 3be9b6ccea
commit ecfbe8f147
7 files changed
+87 -72

No files matched your search

+6 -1
View File
@@ -4,8 +4,13 @@ use clap::Parser;
///
/// Most configuration is done through config files.
#[derive(Parser)]
pub struct Cli {
pub struct Cli {
/// The name of the config file to use.
#[arg(short = 'c', long = "config", default_value = "default")]
pub config_file: String,
/// Enable debug mod.
///
/// This mode prints all active players to stdout, to allow one to find the appropriate player names to use in the config files.
#[arg(short = 'd', long = "debug")]
pub debug: bool,
}
+3 -1
View File
@@ -86,7 +86,7 @@ impl Config {
pub fn find_player_priorities_idx(&self, name: &str) -> i32 {
match self.player_priorities.iter()
.position(|x| x.to_ascii_lowercase().eq(&name.to_ascii_lowercase())) {
.position(|x| x.eq(&name)) {
Some(idx) => idx as i32,
None => i32::MAX,
}
@@ -97,6 +97,8 @@ fn ms(str: &str) -> String {
str.to_string()
}
// FIXME: changed some functions to use case-sensitive matching instead, breaking this
// and also all my existing config files. Whoops
fn default_player_prefixes() -> HashMap<String, char> {
let mut out: HashMap<String, char> = HashMap::new();
+4 -2
View File
@@ -1,7 +1,9 @@
use std::collections::HashMap;
use mpris::Player;
pub struct Data {
pub current_player: Option<String>,
pub current_player: Option<Player>,
pub display_text: HashMap<String, String>,
pub display_prefix: char,
}
@@ -9,7 +11,7 @@ pub struct Data {
impl Default for Data {
fn default() -> Self {
Self {
current_player: None,
current_player: None,
display_text: HashMap::new(),
display_prefix: ' ',
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.