mirror of
				https://github.com/Zedfrigg/ironbar.git
				synced 2025-11-04 07:21:54 +01:00 
			
		
		
		
	feat: Add orientation and direction support for sys info
This commit is contained in:
		
					parent
					
						
							
								70b2c592b2
							
						
					
				
			
			
				commit
				
					
						44be58594b
					
				
			
		
					 10 changed files with 66 additions and 36 deletions
				
			
		| 
						 | 
				
			
			@ -40,9 +40,10 @@ pub enum TransitionType {
 | 
			
		|||
    SlideEnd,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Deserialize, Clone)]
 | 
			
		||||
#[derive(Debug, Default, Deserialize, Clone, Copy)]
 | 
			
		||||
#[serde(rename_all = "snake_case")]
 | 
			
		||||
pub enum ModuleOrientation {
 | 
			
		||||
    #[default]
 | 
			
		||||
    #[serde(alias = "h")]
 | 
			
		||||
    Horizontal,
 | 
			
		||||
    #[serde(alias = "v")]
 | 
			
		||||
| 
						 | 
				
			
			@ -50,10 +51,10 @@ pub enum ModuleOrientation {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
impl ModuleOrientation {
 | 
			
		||||
    pub const fn to_angle(&self) -> f64 {
 | 
			
		||||
    pub const fn to_angle(self) -> f64 {
 | 
			
		||||
        match self {
 | 
			
		||||
            Self::Horizontal => 0.0,
 | 
			
		||||
            Self::Vertical => 90.0
 | 
			
		||||
            Self::Vertical => 90.0,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -61,18 +62,12 @@ impl ModuleOrientation {
 | 
			
		|||
impl From<ModuleOrientation> for Orientation {
 | 
			
		||||
    fn from(o: ModuleOrientation) -> Self {
 | 
			
		||||
        match o {
 | 
			
		||||
            ModuleOrientation::Horizontal => Orientation::Horizontal,
 | 
			
		||||
            ModuleOrientation::Vertical => Orientation::Vertical
 | 
			
		||||
            ModuleOrientation::Horizontal => Self::Horizontal,
 | 
			
		||||
            ModuleOrientation::Vertical => Self::Vertical,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Default for ModuleOrientation {
 | 
			
		||||
    fn default() -> Self {
 | 
			
		||||
        ModuleOrientation::Horizontal
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl TransitionType {
 | 
			
		||||
    pub const fn to_revealer_transition_type(
 | 
			
		||||
        &self,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue