Settings

Struct Settings 

Source
pub struct Settings {
    pub persistent: bool,
    pub show_track_cover: bool,
    pub notification_static_cover: Option<String>,
    pub cover_path_template: Option<String>,
    pub app_name: Option<String>,
    pub cmus_socket_address: Option<String>,
    pub cmus_socket_password: Option<String>,
    pub link: bool,
    pub force_use_external_cover: bool,
    pub no_use_external_cover: bool,
    pub show_player_notifications: bool,
    /* private fields */
}

Fields§

§persistent: bool

Make the notification persistent, i.e. not disappear after a timeout (you can dismiss it manually)

§show_track_cover: bool

Show the track cover in the notification, if available

§notification_static_cover: Option<String>

The static icon to use for the notification, it not effective if the track cover is shown, but if the cover is not available or you disabled it, this icon will be used.

you can give it the full path to an image file or a name of an icon from the current icon theme (e.g. “audio-x-generic” or “spotify-client”)

§cover_path_template: Option<String>

The path to look for the cover image, if not given, the cover will be searched in the track’s directory for an image file with the name “cover”.

You can use the placeholder “{artist}” and “{album}” and “{title}” and “{track_number}” and “{disc_number}” and “{year}” and “{genre}” in the path, they will be replaced with the corresponding metadata. but if the metadata is not available, the placeholder will be replaced with an empty string. And you can use the simple glob pattern * to match any character. e.g. “covers/{artist}/{album}/cover.”, “covers/{artist}/{album}/”,

If you not specify the full path, the cover will be started from the track’s directory.

§app_name: Option<String>

The name of the app to use for the notification.

§cmus_socket_address: Option<String>

The cmus socket address, if not given, the program will use the default socket address, which is “$XDG_RUNTIME_DIR/cmus-socket”.

§cmus_socket_password: Option<String>

The cmus socket password, if any.

§link: bool

Link the program with cmus, if the cmus are not running, the program will exit.

§force_use_external_cover: bool

Force the program to use the external cover file, if available, and not even try to get the cover from the track’s metadata. this is useful if you have a cover file with a better quality than the cover in the track’s metadata.

§no_use_external_cover: bool

No use the external cover file, even if it’s available and the track’s metadata doesn’t have a cover.

§show_player_notifications: bool

Show the player notifications, like if you change the shuffle mode, or the repeat mode, or the volume.

Implementations§

Source§

impl Settings

Source

pub fn load_config_and_parse_args() -> Self

Load the config file and parse the args. And combine them together. The args will override the config. If the config file is not found, create a new one, and use the default values. If the config file is found, but the config is invalid, use the default values.

Source

pub fn timeout(&self) -> i32

Source

pub fn app_name(&self) -> String

Source

pub fn interval(&self) -> u64

Source

pub fn depth(&self) -> u8

Source

pub fn remote_bin_path(&self) -> String

Source

pub fn status_notification_summary(&self) -> String

Source

pub fn status_notification_body(&self) -> String

Source

pub fn status_notification_timeout(&self) -> i32

Source

pub fn summary(&self) -> String

Source

pub fn body(&self) -> String

Source

pub fn volume_notification_summary(&self) -> String

Source

pub fn volume_notification_body(&self) -> String

Source

pub fn volume_notification_timeout(&self) -> i32

Source

pub fn shuffle_notification_summary(&self) -> String

Source

pub fn shuffle_notification_body(&self) -> String

Source

pub fn shuffle_notification_timeout(&self) -> i32

Source

pub fn repeat_notification_summary(&self) -> String

Source

pub fn repeat_notification_body(&self) -> String

Source

pub fn repeat_notification_timeout(&self) -> i32

Source

pub fn aaa_mode_notification_summary(&self) -> String

Source

pub fn aaa_mode_notification_body(&self) -> String

Source

pub fn aaa_mode_notification_timeout(&self) -> i32

Trait Implementations§

Source§

impl Args for Settings

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl CommandFactory for Settings

Source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
Source§

impl Default for Settings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Settings

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FromArgMatches for Settings

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Settings

Source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
Source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
Source§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
Source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
Source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error. Read more
Source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.
Source§

impl Serialize for Settings

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoResult<T> for T

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,