CHange keybind for Session mode and add comments for clarity
This commit is contained in:
parent
cba7c07cd6
commit
c60abe6ad6
5 changed files with 23 additions and 14 deletions
|
|
@ -13,7 +13,7 @@ keybinds:
|
||||||
- action: [SwitchToMode: Scroll,]
|
- action: [SwitchToMode: Scroll,]
|
||||||
key: [Ctrl: 's',]
|
key: [Ctrl: 's',]
|
||||||
- action: [SwitchToMode: Session,]
|
- action: [SwitchToMode: Session,]
|
||||||
key: [Ctrl: 'b',]
|
key: [Ctrl: 'o',]
|
||||||
- action: [Quit,]
|
- action: [Quit,]
|
||||||
key: [Ctrl: 'q',]
|
key: [Ctrl: 'q',]
|
||||||
- action: [NewPane: ]
|
- action: [NewPane: ]
|
||||||
|
|
@ -45,7 +45,7 @@ keybinds:
|
||||||
- action: [SwitchToMode: Scroll,]
|
- action: [SwitchToMode: Scroll,]
|
||||||
key: [Ctrl: 's']
|
key: [Ctrl: 's']
|
||||||
- action: [SwitchToMode: Session,]
|
- action: [SwitchToMode: Session,]
|
||||||
key: [Ctrl: 'b',]
|
key: [Ctrl: 'o',]
|
||||||
- action: [Quit]
|
- action: [Quit]
|
||||||
key: [Ctrl: 'q']
|
key: [Ctrl: 'q']
|
||||||
- action: [Resize: Left,]
|
- action: [Resize: Left,]
|
||||||
|
|
@ -82,7 +82,7 @@ keybinds:
|
||||||
- action: [SwitchToMode: Scroll,]
|
- action: [SwitchToMode: Scroll,]
|
||||||
key: [Ctrl: 's']
|
key: [Ctrl: 's']
|
||||||
- action: [SwitchToMode: Session,]
|
- action: [SwitchToMode: Session,]
|
||||||
key: [Ctrl: 'b',]
|
key: [Ctrl: 'o',]
|
||||||
- action: [Quit,]
|
- action: [Quit,]
|
||||||
key: [Ctrl: 'q',]
|
key: [Ctrl: 'q',]
|
||||||
- action: [MoveFocus: Left,]
|
- action: [MoveFocus: Left,]
|
||||||
|
|
@ -121,7 +121,7 @@ keybinds:
|
||||||
- action: [SwitchToMode: Scroll,]
|
- action: [SwitchToMode: Scroll,]
|
||||||
key: [Ctrl: 's']
|
key: [Ctrl: 's']
|
||||||
- action: [SwitchToMode: Session,]
|
- action: [SwitchToMode: Session,]
|
||||||
key: [Ctrl: 'b',]
|
key: [Ctrl: 'o',]
|
||||||
- action: [SwitchToMode: RenameTab, TabNameInput: [0],]
|
- action: [SwitchToMode: RenameTab, TabNameInput: [0],]
|
||||||
key: [Char: 'r']
|
key: [Char: 'r']
|
||||||
- action: [Quit,]
|
- action: [Quit,]
|
||||||
|
|
@ -177,7 +177,7 @@ keybinds:
|
||||||
- action: [SwitchToMode: Pane,]
|
- action: [SwitchToMode: Pane,]
|
||||||
key: [Ctrl: 'p',]
|
key: [Ctrl: 'p',]
|
||||||
- action: [SwitchToMode: Session,]
|
- action: [SwitchToMode: Session,]
|
||||||
key: [Ctrl: 'b',]
|
key: [Ctrl: 'o',]
|
||||||
- action: [Quit,]
|
- action: [Quit,]
|
||||||
key: [Ctrl: 'q',]
|
key: [Ctrl: 'q',]
|
||||||
- action: [ScrollDown,]
|
- action: [ScrollDown,]
|
||||||
|
|
@ -233,7 +233,7 @@ keybinds:
|
||||||
- action: [SwitchToMode: Tab,]
|
- action: [SwitchToMode: Tab,]
|
||||||
key: [Ctrl: 't',]
|
key: [Ctrl: 't',]
|
||||||
- action: [SwitchToMode: Normal,]
|
- action: [SwitchToMode: Normal,]
|
||||||
key: [Ctrl: 'b', Char: "\n", Char: ' ',]
|
key: [Ctrl: 'o', Char: "\n", Char: ' ',]
|
||||||
- action: [SwitchToMode: Scroll,]
|
- action: [SwitchToMode: Scroll,]
|
||||||
key: [Ctrl: 's']
|
key: [Ctrl: 's']
|
||||||
- action: [Quit,]
|
- action: [Quit,]
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ impl CtrlKeyShortcut {
|
||||||
CtrlKeyAction::Resize => 'r',
|
CtrlKeyAction::Resize => 'r',
|
||||||
CtrlKeyAction::Scroll => 's',
|
CtrlKeyAction::Scroll => 's',
|
||||||
CtrlKeyAction::Quit => 'q',
|
CtrlKeyAction::Quit => 'q',
|
||||||
CtrlKeyAction::Session => 'b',
|
CtrlKeyAction::Session => 'o',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -300,8 +300,8 @@ pub fn ctrl_keys(help: &ModeInfo, max_len: usize, separator: &str) -> LinePart {
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Disabled, CtrlKeyAction::Tab),
|
CtrlKeyShortcut::new(CtrlKeyMode::Disabled, CtrlKeyAction::Tab),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Disabled, CtrlKeyAction::Resize),
|
CtrlKeyShortcut::new(CtrlKeyMode::Disabled, CtrlKeyAction::Resize),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Disabled, CtrlKeyAction::Scroll),
|
CtrlKeyShortcut::new(CtrlKeyMode::Disabled, CtrlKeyAction::Scroll),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Disabled, CtrlKeyAction::Quit),
|
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
||||||
|
CtrlKeyShortcut::new(CtrlKeyMode::Disabled, CtrlKeyAction::Quit),
|
||||||
],
|
],
|
||||||
colored_elements,
|
colored_elements,
|
||||||
separator,
|
separator,
|
||||||
|
|
@ -314,8 +314,8 @@ pub fn ctrl_keys(help: &ModeInfo, max_len: usize, separator: &str) -> LinePart {
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Selected, CtrlKeyAction::Resize),
|
CtrlKeyShortcut::new(CtrlKeyMode::Selected, CtrlKeyAction::Resize),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
||||||
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
||||||
],
|
],
|
||||||
colored_elements,
|
colored_elements,
|
||||||
separator,
|
separator,
|
||||||
|
|
@ -328,8 +328,8 @@ pub fn ctrl_keys(help: &ModeInfo, max_len: usize, separator: &str) -> LinePart {
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
||||||
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
||||||
],
|
],
|
||||||
colored_elements,
|
colored_elements,
|
||||||
separator,
|
separator,
|
||||||
|
|
@ -342,8 +342,8 @@ pub fn ctrl_keys(help: &ModeInfo, max_len: usize, separator: &str) -> LinePart {
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Selected, CtrlKeyAction::Tab),
|
CtrlKeyShortcut::new(CtrlKeyMode::Selected, CtrlKeyAction::Tab),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
||||||
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
||||||
],
|
],
|
||||||
colored_elements,
|
colored_elements,
|
||||||
separator,
|
separator,
|
||||||
|
|
@ -356,8 +356,8 @@ pub fn ctrl_keys(help: &ModeInfo, max_len: usize, separator: &str) -> LinePart {
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Selected, CtrlKeyAction::Scroll),
|
CtrlKeyShortcut::new(CtrlKeyMode::Selected, CtrlKeyAction::Scroll),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
||||||
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
||||||
],
|
],
|
||||||
colored_elements,
|
colored_elements,
|
||||||
separator,
|
separator,
|
||||||
|
|
@ -370,8 +370,8 @@ pub fn ctrl_keys(help: &ModeInfo, max_len: usize, separator: &str) -> LinePart {
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Session),
|
||||||
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
||||||
],
|
],
|
||||||
colored_elements,
|
colored_elements,
|
||||||
separator,
|
separator,
|
||||||
|
|
@ -384,8 +384,8 @@ pub fn ctrl_keys(help: &ModeInfo, max_len: usize, separator: &str) -> LinePart {
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Tab),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Resize),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Scroll),
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
|
||||||
CtrlKeyShortcut::new(CtrlKeyMode::Selected, CtrlKeyAction::Session),
|
CtrlKeyShortcut::new(CtrlKeyMode::Selected, CtrlKeyAction::Session),
|
||||||
|
CtrlKeyShortcut::new(CtrlKeyMode::Unselected, CtrlKeyAction::Quit),
|
||||||
],
|
],
|
||||||
colored_elements,
|
colored_elements,
|
||||||
separator,
|
separator,
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,9 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
}
|
}
|
||||||
ServerInstruction::Render(output) => {
|
ServerInstruction::Render(output) => {
|
||||||
if *session_state.read().unwrap() == SessionState::Attached {
|
if *session_state.read().unwrap() == SessionState::Attached {
|
||||||
|
// Here output is of type Option<String> sent by screen thread.
|
||||||
|
// If `Some(_)`- unwrap it and forward it to the client to render.
|
||||||
|
// If `None`- Send an exit instruction. This is the case when the user closes last Tab/Pane.
|
||||||
if let Some(op) = output {
|
if let Some(op) = output {
|
||||||
os_input.send_to_client(ServerToClientMsg::Render(op));
|
os_input.send_to_client(ServerToClientMsg::Render(op));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,11 @@ pub trait ServerOsApi: Send + Sync {
|
||||||
fn send_to_client(&self, msg: ServerToClientMsg);
|
fn send_to_client(&self, msg: ServerToClientMsg);
|
||||||
/// Adds a sender to client
|
/// Adds a sender to client
|
||||||
fn add_client_sender(&self);
|
fn add_client_sender(&self);
|
||||||
|
/// Send to the temporary client
|
||||||
|
// A temporary client is the one that hasn't been registered as a client yet.
|
||||||
|
// Only the corresponding router thread has access to send messages to it.
|
||||||
|
// This can be the case when the client cannot attach to the session,
|
||||||
|
// so it tries to connect and then exits, hence temporary.
|
||||||
fn send_to_temp_client(&self, msg: ServerToClientMsg);
|
fn send_to_temp_client(&self, msg: ServerToClientMsg);
|
||||||
/// Removes the sender to client
|
/// Removes the sender to client
|
||||||
fn remove_client_sender(&self);
|
fn remove_client_sender(&self);
|
||||||
|
|
|
||||||
|
|
@ -730,6 +730,7 @@ impl Tab {
|
||||||
{
|
{
|
||||||
// we might not have an active terminal if we closed the last pane
|
// we might not have an active terminal if we closed the last pane
|
||||||
// in that case, we should not render as the app is exiting
|
// in that case, we should not render as the app is exiting
|
||||||
|
// or if this session is not attached to a client, we do not have to render
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if any pane contain widechar, all pane in the same row will messup. We should render them every time
|
// if any pane contain widechar, all pane in the same row will messup. We should render them every time
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue