Skip to content

Commit fbcac22

Browse files
authored
Merge pull request #354 from sashetophizika/fullscreenstate
feat: add ToggleFullscreenState dispatcher
2 parents 7665f08 + d4183d9 commit fbcac22

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/dispatch.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,23 @@ pub enum FullscreenType {
6464
NoParam,
6565
}
6666

67+
/// This enum holds the params to the [DispatchType::ToggleFullscreenState] dispatcher
68+
#[allow(missing_docs)]
69+
#[derive(Debug, Clone, Copy)]
70+
pub enum FullscreenState {
71+
Current = -1,
72+
None = 0,
73+
Maximize = 1,
74+
Fullscreen = 2,
75+
MaximizeFullscreen = 3,
76+
}
77+
78+
impl std::fmt::Display for FullscreenState {
79+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
80+
write!(f, "{}", *self as i8)
81+
}
82+
}
83+
6784
/// This enum holds directions, typically used for moving
6885
#[derive(Debug, Clone, Display)]
6986
#[allow(missing_docs)]
@@ -432,6 +449,8 @@ pub enum DispatchType<'a> {
432449
ToggleFloating(Option<WindowIdentifier<'a>>),
433450
/// This dispatcher toggles the current window fullscreen state
434451
ToggleFullscreen(FullscreenType),
452+
/// This dispatcher sets the focused window’s fullscreen mode and the one sent to the client
453+
ToggleFullscreenState(FullscreenState, FullscreenState),
435454
/// This dispatcher toggles the focused window’s internal
436455
/// fullscreen state without altering the geometry
437456
ToggleFakeFullscreen,
@@ -705,6 +724,7 @@ pub(crate) fn gen_dispatch_str(cmd: DispatchType, dispatch: bool) -> crate::Resu
705724
ToggleFloating(Some(v)) => format!("togglefloating{sep}{v}"),
706725
ToggleFloating(None) => "togglefloating".to_string(),
707726
ToggleFullscreen(ftype) => format!("fullscreen{sep}{ftype}"),
727+
ToggleFullscreenState(int, cl) => format!("fullscreenstate{sep}{int} {cl}"),
708728
ToggleFakeFullscreen => "fakefullscreen".to_string(),
709729
ToggleDPMS(stat, mon) => {
710730
format!(

0 commit comments

Comments
 (0)