diff options
| author | Aram Drevekenin <aram@poor.dev> | 2023-02-17 12:05:50 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-17 12:05:50 +0100 |
| commit | f1ff272b0b65f6d328fef24531ada67ea585ce85 (patch) | |
| tree | 0e33aa4a1af21c0785fa30118ee42a21972497cf /zellij-utils/src/setup.rs | |
| parent | docs(changelog): termwiz update (diff) | |
| download | sl0ppij-f1ff272b0b65f6d328fef24531ada67ea585ce85.tar.gz sl0ppij-f1ff272b0b65f6d328fef24531ada67ea585ce85.tar.xz sl0ppij-f1ff272b0b65f6d328fef24531ada67ea585ce85.zip | |
feat(ui): swap layouts and stacked panes (#2167)
* relayout working with hard coded layout
* work
* refactor(layout): PaneLayout => TiledPaneLayout
* tests passing
* tests passing
* tests passing
* stacked panes and passing tests
* tests for stacked panes
* refactor(panes): stacked panes
* fix: focusing into stacked panes from the left/right
* fix(layouts): handle stacked layouts in the middle of the screen
* fix(pane-stack): focus correctly when coming to stack from above/below
* fix(stacked-panes): resize stack
* fix(stacked-panes): focus with mouse
* fix(stacked-panes): focus next pane
* fix(layout-applier): sane focus order
* fix(stacked-panes): better titles for one-liners
* fix(stacked-panes): handle moving pane location in stack
* fix(relayout): properly calculate display area
* fix(relayout): properly calculate rounding errors
* fix(stacked-panes): properly handle closing a pane near a stack
* fix(swap-layouts): adjust swap layout sort order
* feat(swap-layouts): ui + ux
* fix(swap-layouts): include base layout
* refactor(layout): remove unused method
* fix(swap-layouts): respect pane contents and focus
* work
* fix(swap-layouts): load swap layouts from external file
* fix(swap-layouts): properly truncate layout children
* fix(stacked-panes): allow stacked panes to become fullscreen
* fix(swap-layouts): work with multiple tabs
* fix(swap-layouts): embed/eject panes properly with auto-layout
* fix(stacked-panes): close last pane in stack
* fix(stacked-panes): move focus for all clients in stack
* fix(floating-panes): set layout damaged when moving panes
* fix(relayout): move out of unfitting layout when resizing whole tab
* fix(ui): background color for swap layout indicator
* fix(keybinds): add switch next layout in tmux
* fix(ui): swap layout indication in compact layout
* fix(compact): correct swap constraint
* fix(tests): tmux swap config shortcut
* fix(resizes): cache resizes so as not to confuse panes (eg. vim) with multiple resizes that it debounces weirdly
* feat(cli): dump swap layouts
* fix(ui): stacked panes without pane frames
* fix(ux): move pane forward/backwards also with floating panes
* refactor(lint): remove unused stuff
* refactor(tab): move swap layouts to separate file
* style(fmt): rustfmt
* style(fmt): rustfmt
* refactor(panes): various cleanups
* chore(deps): upgrade termwiz to get alt left-bracket
* fix(assets): merge conflicts of binary files
* style(fmt): rustfmt
* style(clippy): no thank you!
* chore(repo): remove garbage file
Diffstat (limited to 'zellij-utils/src/setup.rs')
| -rw-r--r-- | zellij-utils/src/setup.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs index ddbc5967..2c4d8989 100644 --- a/zellij-utils/src/setup.rs +++ b/zellij-utils/src/setup.rs @@ -104,12 +104,24 @@ pub const DEFAULT_LAYOUT: &[u8] = include_bytes!(concat!( "assets/layouts/default.kdl" )); +pub const DEFAULT_SWAP_LAYOUT: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/", + "assets/layouts/default.swap.kdl" +)); + pub const STRIDER_LAYOUT: &[u8] = include_bytes!(concat!( env!("CARGO_MANIFEST_DIR"), "/", "assets/layouts/strider.kdl" )); +pub const STRIDER_SWAP_LAYOUT: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/", + "assets/layouts/strider.swap.kdl" +)); + pub const NO_STATUS_LAYOUT: &[u8] = include_bytes!(concat!( env!("CARGO_MANIFEST_DIR"), "/", @@ -122,6 +134,12 @@ pub const COMPACT_BAR_LAYOUT: &[u8] = include_bytes!(concat!( "assets/layouts/compact.kdl" )); +pub const COMPACT_BAR_SWAP_LAYOUT: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/", + "assets/layouts/compact.swap.kdl" +)); + pub const FISH_EXTRA_COMPLETION: &[u8] = include_bytes!(concat!( env!("CARGO_MANIFEST_DIR"), "/", @@ -175,6 +193,18 @@ pub fn dump_specified_layout(layout: &str) -> std::io::Result<()> { } } +pub fn dump_specified_swap_layout(swap_layout: &str) -> std::io::Result<()> { + match swap_layout { + "strider" => dump_asset(STRIDER_SWAP_LAYOUT), + "default" => dump_asset(DEFAULT_SWAP_LAYOUT), + "compact" => dump_asset(COMPACT_BAR_SWAP_LAYOUT), + not_found => Err(std::io::Error::new( + std::io::ErrorKind::Other, + format!("Swap Layout not found for: {}", not_found), + )), + } +} + #[cfg(not(target_family = "wasm"))] pub fn dump_builtin_plugins(path: &PathBuf) -> Result<()> { for (asset_path, bytes) in ASSET_MAP.iter() { @@ -230,6 +260,10 @@ pub struct Setup { #[clap(long, value_parser)] pub dump_layout: Option<String>, + /// Dump the specified swap layout file to stdout + #[clap(long, value_parser)] + pub dump_swap_layout: Option<String>, + /// Dump the builtin plugins to DIR or "DATA DIR" if unspecified #[clap( long, @@ -337,6 +371,11 @@ impl Setup { std::process::exit(0); } + if let Some(swap_layout) = &self.dump_swap_layout { + dump_specified_swap_layout(swap_layout)?; + std::process::exit(0); + } + Ok(()) } |
