Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Float Pane #5576

Open
wants to merge 67 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
5ee02e4
Attempt at float pane
e82eric Jun 17, 2024
518e0c8
Try to prevent changes when a float is being shown
e82eric Jun 18, 2024
be7d669
Trying to get cli float-pane to work
e82eric Jun 19, 2024
6da5f03
Reverted changes to allow float pane size configuration
e82eric Jun 19, 2024
83b7974
Experiment with float borders
e82eric Jun 20, 2024
44c8a21
float padding config
e82eric Jun 21, 2024
3bcf229
Remove float pane from tab.panes
e82eric Jun 23, 2024
f9de55f
Removed pane_id where not needed
e82eric Jun 23, 2024
543af2b
More accurate float borders
e82eric Jul 2, 2024
275567a
Handle Resize
e82eric Jul 3, 2024
203e362
Better mouse handling
e82eric Jul 3, 2024
a3e7444
Clean up
e82eric Jul 3, 2024
e8ee2a8
Update float-pane to use cwd instead of home directory
e82eric Jul 13, 2024
128a1ca
prevent running pane manipulation actions when float pane is active
e82eric Jul 14, 2024
adba9f2
Updated float pane icons
e82eric Aug 9, 2024
cd0ee5f
Floating pane: address initial feedback
e82eric Sep 21, 2024
e567786
Fix for not creating float pane in multiplexer
e82eric Sep 22, 2024
55b9d8a
Support for floating panes in cli list-panes
e82eric Sep 23, 2024
7b20a18
Re-attach the floating pane
e82eric Sep 23, 2024
29d3988
Fix for floating pane not being removed from all connected wezterms for
e82eric Sep 24, 2024
5ad7fe6
Refactored remove_float_pane
e82eric Sep 24, 2024
b2e2b79
Fix for floating pane not working with rotate_clockwise and
e82eric Sep 25, 2024
7fa4cca
Refactor compute_background_rect
e82eric Sep 26, 2024
d771fb7
bump codec version
e82eric Sep 26, 2024
20fbe7a
Fix for resize not being applied to floating pane when updating window
e82eric Sep 26, 2024
e240f67
Attempt at being able to hide the floating pane
e82eric Sep 29, 2024
0d05175
Add is_floating to cli list
e82eric Oct 5, 2024
9534be7
Update to only hide the floating pane if clicked outside of floating
e82eric Oct 5, 2024
2fb7f8b
Update so that cli active-pane --pane-id works floating pane.
e82eric Oct 5, 2024
d5a0072
Bump codec version
e82eric Oct 6, 2024
2e83b11
Update so that cli activate-pane will show/hide the floating pane when
e82eric Oct 6, 2024
9cb6443
Fix for cli list floating_pane.is_active always being true
e82eric Oct 6, 2024
ab7acd6
Revert "Update so that cli activate-pane will show/hide the floating …
e82eric Oct 6, 2024
c534829
Fix for activate-pane --pane-id (selecting non floating pane when
e82eric Oct 6, 2024
7852213
Update so that cli activate-pane will show/hide the floating pane when
e82eric Oct 6, 2024
cfe8edf
Kill the floating pane if it is the last remaining pane in the tab (I
e82eric Oct 7, 2024
bb4b59d
Update toggle floating pane to create floating pane if it doesn't exist
e82eric Oct 8, 2024
2bf08bb
Attempt at being able to move a float pane to a split pane
e82eric Jul 14, 2024
09d1b6e
Ability to move existing pane to a floating pane
e82eric Oct 10, 2024
1da1d9f
Some clean up for move floating pane to split
e82eric Oct 10, 2024
b0c3dd1
Update move pane to floating pane to use selection UI
e82eric Oct 10, 2024
3a24295
More clean up of moving floating panes to horizontal and vertical splits
e82eric Oct 11, 2024
2c231f5
Use floating_pane instead of float_pane
e82eric Oct 11, 2024
f477cac
Basic support for multiple floating panes
e82eric Oct 11, 2024
691e8f6
Support for move pervious, move next in floating panes
e82eric Oct 12, 2024
a68e7d3
Fix list and activate floating panes from cli
e82eric Oct 12, 2024
84b4390
Fixes for move floting pane to split and Move pane to floating pane
e82eric Oct 12, 2024
2ff6f96
Use floating pane instead float pane
e82eric Oct 12, 2024
2da46fe
Fixes for move floating pane to split where there are multiple floating
e82eric Oct 12, 2024
c116dea
Update so zoom works with floating pane
e82eric Oct 13, 2024
b332626
Update so that moving a floating pane to a split hides other floating
e82eric Oct 13, 2024
50634cf
Clean up floating pane code
e82eric Oct 13, 2024
2e9d54f
Merge remote-tracking branch 'origin/main' into multiple-floating-panes
e82eric Oct 13, 2024
3034fc6
Update that cli uses spwan instead of float-pane to create floating pane
e82eric Oct 13, 2024
e489871
Refactored floating pane code in mux/src/(lib|tab).rs
e82eric Oct 14, 2024
426f0e2
Try to improve floating pane defaults
e82eric Oct 16, 2024
0f4010d
Fix for overlays (quick-select, find, copy mode) not working with
e82eric Oct 18, 2024
ad6439d
Fix for tab level overlays being hidden by floating pane.
e82eric Oct 18, 2024
435d838
Update so that cli move-pane-to-new-tab works with floating panes
e82eric Oct 18, 2024
107b353
Update so that floating panes are included in tab pane counts
e82eric Oct 19, 2024
d14d094
Update move_floating_pane_to_split to match move_pane_to_new_tab
e82eric Oct 19, 2024
32b6ca3
Simplified move_floating_pane_to_split
e82eric Oct 19, 2024
aa19544
Clean up floating pane code
e82eric Oct 19, 2024
9691610
Removed ctrl|shift|e default key binding for toggle floating pane. (Not
e82eric Oct 19, 2024
181884c
Update so that floating panes are hidden when a normal pane is activated
e82eric Oct 19, 2024
31afd6c
Clarified floating pane mouse handling in comments
e82eric Oct 20, 2024
068a321
Add scrollbar support for floating panes
e82eric Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use anyhow::{bail, Context as _, Error};
use config::keyassignment::{PaneDirection, ScrollbackEraseMode};
use mux::client::{ClientId, ClientInfo};
use mux::pane::PaneId;
use mux::pane::{PaneId};
use mux::renderable::{RenderableDimensions, StableCursorPosition};
use mux::tab::{PaneNode, SerdeUrl, SplitRequest, TabId};
use mux::tab::{SerdeUrl, SplitDirection, SplitRequest, TabEntry, TabId};
use mux::window::WindowId;
use portable_pty::CommandBuilder;
use rangeset::*;
Expand Down Expand Up @@ -441,7 +441,7 @@ macro_rules! pdu {
/// The overall version of the codec.
/// This must be bumped when backwards incompatible changes
/// are made to the types and protocol.
pub const CODEC_VERSION: usize = 43;
pub const CODEC_VERSION: usize = 45;

// Defines the Pdu enum.
// Each struct has an explicit identifying number.
Expand Down Expand Up @@ -502,6 +502,11 @@ pdu! {
GetPaneDirection: 60,
GetPaneDirectionResponse: 61,
AdjustPaneSize: 62,
SpawnFloatingPane: 63,
FloatingPaneVisibilityChanged: 64,
MoveFloatingPaneToSplit: 65,
MovePaneToFloatingPane: 66,
ActiveFloatingPaneChanged: 67,
}

impl Pdu {
Expand Down Expand Up @@ -644,11 +649,31 @@ pub struct ListPanes {}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct ListPanesResponse {
pub tabs: Vec<PaneNode>,
pub tabs: Vec<TabEntry>,
pub tab_titles: Vec<String>,
pub window_titles: HashMap<WindowId, String>,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct SpawnFloatingPane {
pub pane_id: PaneId,
pub command: Option<CommandBuilder>,
pub command_dir: Option<String>,
pub domain: config::keyassignment::SpawnTabDomain,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct FloatingPaneVisibilityChanged {
pub tab_id: TabId,
pub visible: bool
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct ActiveFloatingPaneChanged {
pub index: usize,
pub tab_id: TabId,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct SplitPane {
pub pane_id: PaneId,
Expand All @@ -661,6 +686,17 @@ pub struct SplitPane {
pub move_pane_id: Option<PaneId>,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct MovePaneToFloatingPane {
pub pane_id: PaneId,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct MoveFloatingPaneToSplit {
pub pane_id: PaneId,
pub split_direction: SplitDirection,
}

#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct MovePaneToNewTab {
pub pane_id: PaneId,
Expand Down
32 changes: 32 additions & 0 deletions config/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,23 @@ pub struct WindowFrameConfig {
pub border_bottom_color: Option<RgbaColor>,
}

#[derive(Debug, Clone, FromDynamic, ToDynamic)]
pub struct FloatingPaneBorderConfig {
#[dynamic(try_from = "crate::units::PixelUnit", default = "default_zero_pixel")]
pub left_width: Dimension,
#[dynamic(try_from = "crate::units::PixelUnit", default = "default_zero_pixel")]
pub right_width: Dimension,
#[dynamic(try_from = "crate::units::PixelUnit", default = "default_zero_pixel")]
pub top_height: Dimension,
#[dynamic(try_from = "crate::units::PixelUnit", default = "default_zero_pixel")]
pub bottom_height: Dimension,

pub left_color: Option<RgbaColor>,
pub right_color: Option<RgbaColor>,
pub top_color: Option<RgbaColor>,
pub bottom_color: Option<RgbaColor>,
}

const fn default_zero_pixel() -> Dimension {
Dimension::Pixels(0.)
}
Expand Down Expand Up @@ -629,6 +646,21 @@ impl Default for WindowFrameConfig {
}
}

impl Default for FloatingPaneBorderConfig {
fn default() -> Self {
Self {
left_width: Dimension::Pixels(3.),
right_width: Dimension::Pixels(3.),
top_height: Dimension::Pixels(3.),
bottom_height: Dimension::Pixels(3.),
left_color: Some(default_active_titlebar_bg()),
right_color: Some(default_active_titlebar_bg()),
top_color: Some(default_active_titlebar_bg()),
bottom_color: Some(default_active_titlebar_bg()),
}
}
}

fn default_inactive_titlebar_bg() -> RgbaColor {
RgbColor::new_8bpc(0x33, 0x33, 0x33).into()
}
Expand Down
17 changes: 16 additions & 1 deletion config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
default_true, default_win32_acrylic_accent_color, GpuInfo, IntegratedTitleButtonColor,
KeyMapPreference, LoadedConfig, MouseEventTriggerMods, RgbaColor, SerialDomain, SystemBackdrop,
WebGpuPowerPreference, CONFIG_DIRS, CONFIG_FILE_OVERRIDE, CONFIG_OVERRIDES, CONFIG_SKIP,
HOME_DIR,
HOME_DIR, FloatingPaneBorderConfig
};
use anyhow::Context;
use luahelper::impl_lua_conversion_dynamic;
Expand Down Expand Up @@ -142,6 +142,9 @@ pub struct Config {
#[dynamic(default)]
pub window_frame: WindowFrameConfig,

#[dynamic(default)]
pub floating_pane_border: FloatingPaneBorderConfig,

#[dynamic(default = "default_char_select_font_size")]
pub char_select_font_size: f64,

Expand Down Expand Up @@ -521,6 +524,9 @@ pub struct Config {
#[dynamic(default)]
pub window_padding: WindowPadding,

#[dynamic(default = "default_floating_pane_padding")]
pub floating_pane_padding: WindowPadding,

/// Specifies the path to a background image attachment file.
/// The file can be any image format that the rust `image`
/// crate is able to identify and load.
Expand Down Expand Up @@ -1579,6 +1585,15 @@ fn default_integrated_title_buttons() -> Vec<IntegratedTitleButton> {
vec![Hide, Maximize, Close]
}

fn default_floating_pane_padding() -> WindowPadding {
WindowPadding{
left: Dimension::Percent(0.20),
top: Dimension::Percent(0.20),
right: Dimension::Percent(0.20),
bottom: Dimension::Percent(0.20),
}
}

fn default_char_select_font_size() -> f64 {
18.0
}
Expand Down
5 changes: 5 additions & 0 deletions config/src/keyassignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ pub enum PaneSelectMode {
SwapWithActiveKeepFocus,
MoveToNewTab,
MoveToNewWindow,
MoveToFloatingPane
}

impl Default for PaneSelectMode {
Expand Down Expand Up @@ -557,8 +558,10 @@ pub enum KeyAssignment {
QuitApplication,
SpawnCommandInNewTab(SpawnCommand),
SpawnCommandInNewWindow(SpawnCommand),
SpawnCommandInNewFloatingPane(SpawnCommand),
SplitHorizontal(SpawnCommand),
SplitVertical(SpawnCommand),
ToggleFloatingPane,
ShowLauncher,
ShowLauncherArgs(LauncherActionArgs),
ClearScrollback(ScrollbackEraseMode),
Expand Down Expand Up @@ -625,6 +628,8 @@ pub enum KeyAssignment {
ActivateWindowRelativeNoWrap(isize),
PromptInputLine(PromptInputLine),
InputSelector(InputSelector),
MoveFloatingPaneToHorizontalSplit,
MoveFloatingPaneToVerticalSplit,
}
impl_lua_conversion_dynamic!(KeyAssignment);

Expand Down
2 changes: 1 addition & 1 deletion deps/harfbuzz/harfbuzz
Submodule harfbuzz updated 420 files
1 change: 1 addition & 0 deletions docs/config/lua/MuxTab/panes_with_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Each element is a lua table with the following fields:
* `index` - the topological pane index
* `is_active` - a boolean indicating whether this is the active pane within the tab
* `is_zoomed` - a boolean indicating whether this pane is zoomed
* `is_floating` - a boolean indicating whether this pane is floating
* `left` - The offset from the top left corner of the containing tab to the top left corner of this pane, in cells.
* `top` - The offset from the top left corner of the containing tab to the top left corner of this pane, in cells.
* `width` - The width of this pane in cells
Expand Down
1 change: 1 addition & 0 deletions docs/config/lua/PaneInformation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The `PaneInformation` struct contains the following fields:
* `pane_index` - the logical position of the pane within its containing layout
* `is_active` - is true if the pane is the active pane within its containing tab
* `is_zoomed` - is true if the pane is in the zoomed state
* `is_floating` - is true if the pane is in the floating state
* `left` - the cell x coordinate of the left edge of the pane
* `top` - the cell y coordinate of the top edge of the pane
* `width` - the width of the pane in cells
Expand Down
36 changes: 35 additions & 1 deletion mux/src/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use crate::localpane::LocalPane;
use crate::pane::{alloc_pane_id, Pane, PaneId};
use crate::tab::{SplitRequest, Tab, TabId};
use crate::tab::{SplitDirection, SplitRequest, Tab, TabId};
use crate::window::WindowId;
use crate::Mux;
use anyhow::{bail, Context, Error};
Expand Down Expand Up @@ -71,6 +71,33 @@ pub trait Domain: Downcast + Send + Sync {
Ok(tab)
}

async fn add_floating_pane(
&self,
tab: TabId,
_pane_id: PaneId,
command_builder: Option<CommandBuilder>,
command_dir: Option<String>
) -> anyhow::Result<Arc<dyn Pane>> {
let mux = Mux::get();
let tab = match mux.get_tab(tab) {
Some(t) => t,
None => anyhow::bail!("Invalid tab id {}", tab),
};

let size = tab.compute_floating_pane_size();
let pane = self.spawn_pane(size, command_builder, command_dir).await?;
tab.add_floating_pane(size, Arc::clone(&pane))?;
Ok(pane)
}

async fn move_floating_pane_to_split(
&self,
_tab: TabId,
_direction: SplitDirection,
) -> anyhow::Result<bool> {
Ok(false)
}

async fn split_pane(
&self,
source: SplitSource,
Expand Down Expand Up @@ -151,6 +178,13 @@ pub trait Domain: Downcast + Send + Sync {
Ok(None)
}

async fn move_pane_to_floating_pane(
&self,
_pane_id: PaneId,
) -> anyhow::Result<bool> {
Ok(false)
}

/// Returns false if the `spawn` method will never succeed.
/// There are some internal placeholder domains that are
/// pre-created with local UI that we do not want to allow
Expand Down
Loading