feat(panel-button): add applet config
This PR adds an optional environment variable to the cosmic-panel-button that allows us to specify how a panel button should present itself (either as 'icon' or as 'text'). The PR also adds the same tracing log that the other applets have, with an initial message notifying that the applet has started.
This commit is contained in:
parent
40509c669f
commit
5d4ef77367
5 changed files with 110 additions and 7 deletions
44
cosmic-panel-button/src/config.rs
Normal file
44
cosmic-panel-button/src/config.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use cosmic_config::{cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, PartialEq, Clone, CosmicConfigEntry)]
|
||||
#[version = 1]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct CosmicPanelButtonConfig {
|
||||
/// configs indexed by panel name
|
||||
pub configs: HashMap<String, IndividualConfig>,
|
||||
}
|
||||
|
||||
impl Default for CosmicPanelButtonConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
configs: HashMap::from([
|
||||
(
|
||||
"Panel".to_string(),
|
||||
IndividualConfig {
|
||||
force_presentation: None,
|
||||
},
|
||||
),
|
||||
(
|
||||
"Dock".to_string(),
|
||||
IndividualConfig {
|
||||
force_presentation: Some(Override::Icon),
|
||||
},
|
||||
),
|
||||
]),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, PartialEq, Default, Clone)]
|
||||
pub struct IndividualConfig {
|
||||
pub force_presentation: Option<Override>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub enum Override {
|
||||
Icon,
|
||||
Text,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue