#[non_exhaustive]pub enum WindowAction<I: ApplicationInfo> {
Close(WindowTarget, CloseFlags),
Exchange(FocusChange),
Focus(FocusChange),
MoveSide(MoveDir2D),
Open(OpenTarget<I::WindowId>, Axis, MoveDir1D, Count),
Rotate(MoveDir1D),
Split(OpenTarget<I::WindowId>, Axis, MoveDir1D, Count),
Switch(OpenTarget<I::WindowId>),
ClearSizes,
Resize(FocusChange, Axis, SizeChange),
Write(WindowTarget, Option<String>, WriteFlags),
ZoomToggle,
}Expand description
Actions for manipulating application windows.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Close(WindowTarget, CloseFlags)
Close the WindowTarget windows with CloseFlags options.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let fc = WindowTarget::Single(FocusChange::Current);
let flags = CloseFlags::NONE;
let extract: Action = WindowAction::Close(fc, flags).into();
assert_eq!(extract, action!("window close -t (single current) -F none"));Exchange(FocusChange)
Exchange the currently focused window with the window targeted by FocusChange.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let fc = FocusChange::PreviouslyFocused;
let act: Action = WindowAction::Exchange(fc).into();
assert_eq!(act, action!("window exchange -f previously-focused"));Focus(FocusChange)
Change the current focus to the window targeted by FocusChange.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let fc = FocusChange::PreviouslyFocused;
let act: Action = WindowAction::Focus(fc).into();
assert_eq!(act, action!("window focus -f previously-focused"));MoveSide(MoveDir2D)
Move the currently focused window to the MoveDir2D side of the screen.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let act: Action = WindowAction::MoveSide(MoveDir2D::Left).into();
assert_eq!(act, action!("window move-side -d left"));Open(OpenTarget<I::WindowId>, Axis, MoveDir1D, Count)
Open a new window that is n columns along an axis, positioned relative to the current window as indicated by MoveDir1D.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let target = OpenTarget::Unnamed;
let axis = Axis::Horizontal;
let dir = MoveDir1D::Next;
let count = Count::Contextual;
let act: Action = WindowAction::Open(target, axis, dir, count).into();
// All of these are equivalent:
assert_eq!(act, action!("window open -t unnamed -x horizontal -d next -c ctx"));
assert_eq!(act, action!("window open -t unnamed -x horizontal -d next"));Rotate(MoveDir1D)
Visually rotate the windows in MoveDir2D direction.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let act: Action = WindowAction::Rotate(MoveDir1D::Next).into();
assert_eq!(act, action!("window rotate -d next"));Split(OpenTarget<I::WindowId>, Axis, MoveDir1D, Count)
Split the currently focused window n times along an axis, moving the focus in MoveDir1D direction after performing the split.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let target = OpenTarget::Current;
let axis = Axis::Vertical;
let dir = MoveDir1D::Next;
let count = Count::Contextual;
let act: Action = WindowAction::Split(target, axis, dir, count).into();
// All of these are equivalent:
assert_eq!(act, action!("window split -t current -x vertical -d next -c ctx"));
assert_eq!(act, action!("window split -t current -x vertical -d next"));Switch(OpenTarget<I::WindowId>)
Switch what content the window is currently showing.
If there are no currently open windows in the tab, then this behaves like WindowAction::Open.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let target = OpenTarget::Offset(MoveDir1D::Next, 5.into());
let switch: Action = WindowAction::Switch(target).into();
assert_eq!(switch, action!("window switch -t (offset -d next -c 5)"));ClearSizes
Clear all of the explicitly set window sizes, and instead try to equally distribute available rows and columns.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let act: Action = WindowAction::ClearSizes.into();
assert_eq!(act, action!("window clear-sizes"));Resize(FocusChange, Axis, SizeChange)
Resize the window targeted by FocusChange according to SizeChange.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let size = SizeChange::Equal;
let act: Action = WindowAction::Resize(FocusChange::Current, Axis::Vertical, size).into();
assert_eq!(act, action!("window resize -f current -x vertical -z equal"));Write(WindowTarget, Option<String>, WriteFlags)
Write the contents of the windows targeted by WindowTarget.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let target = WindowTarget::All;
let flags = WriteFlags::NONE;
let act: Action = WindowAction::Write(target, None, flags).into();
assert_eq!(act, action!("window write -t all -F none"));ZoomToggle
Zoom in on the currently focused window so that it takes up the whole screen. If there is already a zoomed-in window, then return to showing all windows.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, WindowAction};
let act: Action = WindowAction::ZoomToggle.into();
assert_eq!(act, action!("window zoom-toggle"));Trait Implementations§
Source§impl<I: Clone + ApplicationInfo> Clone for WindowAction<I>
impl<I: Clone + ApplicationInfo> Clone for WindowAction<I>
Source§fn clone(&self) -> WindowAction<I>
fn clone(&self) -> WindowAction<I>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more