feat(audio): respect amplification config
This commit is contained in:
parent
c54bf8e189
commit
5a4f4c2018
3 changed files with 103 additions and 68 deletions
|
|
@ -1,9 +1,29 @@
|
|||
// Copyright 2023 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use cosmic::cosmic_config::{self, CosmicConfigEntry, cosmic_config_derive::CosmicConfigEntry};
|
||||
use cosmic::cosmic_config::{
|
||||
self, Config, ConfigGet, CosmicConfigEntry, cosmic_config_derive::CosmicConfigEntry,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
const AUDIO_CONFIG: &str = "com.system76.CosmicAudio";
|
||||
const AMPLIFICATION_SINK: &str = "amplification_sink";
|
||||
const AMPLIFICATION_SOURCE: &str = "amplification_source";
|
||||
|
||||
pub fn amplification_sink() -> bool {
|
||||
Config::new(AUDIO_CONFIG, 1)
|
||||
.ok()
|
||||
.and_then(|config| config.get::<bool>(AMPLIFICATION_SINK).ok())
|
||||
.unwrap_or(true)
|
||||
}
|
||||
|
||||
pub fn amplification_source() -> bool {
|
||||
Config::new(AUDIO_CONFIG, 1)
|
||||
.ok()
|
||||
.and_then(|config| config.get::<bool>(AMPLIFICATION_SOURCE).ok())
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize, CosmicConfigEntry, PartialEq, Eq)]
|
||||
#[version = 1]
|
||||
pub struct AudioAppletConfig {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue