generated from edfloreshz/cosmic-app-template
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: option to force panel button to display icons instead of text
This commit adds the ability to tell COSMIC panel buttons (for example, the Launcher button, the App Library button, and the Workspaces button) to always present themselves as an icon on a Panel instead of being text on horizontal panels, and icons on vertical panels. Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
- Loading branch information
Showing
4 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use std::collections::HashMap; | ||
|
||
use cosmic::cosmic_config; | ||
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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod config; | ||
pub mod cosmic_panel_button_config; | ||
pub mod icons; | ||
pub mod localization; | ||
pub mod nav; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters