Merge branch 'main' into unified-logging
This commit is contained in:
commit
f0bc297743
26 changed files with 250 additions and 112 deletions
18
CHANGELOG.md
18
CHANGELOG.md
|
|
@ -5,8 +5,26 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
* Plugins don't crash zellij anymore on receiving mouse events (https://github.com/zellij-org/zellij/pull/620)
|
||||||
|
|
||||||
|
|
||||||
|
## [0.15.0] - 2021-07-19
|
||||||
* Kill children properly (https://github.com/zellij-org/zellij/pull/601)
|
* Kill children properly (https://github.com/zellij-org/zellij/pull/601)
|
||||||
* Change name of `Run` binding for actions (https://github.com/zellij-org/zellij/pull/602)
|
* Change name of `Run` binding for actions (https://github.com/zellij-org/zellij/pull/602)
|
||||||
|
* Add running commands to `layouts` (https://github.com/zellij-org/zellij/pull/600)
|
||||||
|
|
||||||
|
POSSIBLE BREAKING CHANGE for custom layouts:
|
||||||
|
Plugins are under the run category now, that means:
|
||||||
|
```
|
||||||
|
plugin: status-bar
|
||||||
|
```
|
||||||
|
is now:
|
||||||
|
```
|
||||||
|
run:
|
||||||
|
plugin: status-bar
|
||||||
|
```
|
||||||
|
* Add `on_force_close` config option (https://github.com/zellij-org/zellij/pull/609)
|
||||||
|
|
||||||
|
|
||||||
## [0.14.0] - 2021-07-05
|
## [0.14.0] - 2021-07-05
|
||||||
* Add improved error handling for layouts (https://github.com/zellij-org/zellij/pull/576)
|
* Add improved error handling for layouts (https://github.com/zellij-org/zellij/pull/576)
|
||||||
|
|
|
||||||
12
Cargo.lock
generated
12
Cargo.lock
generated
|
|
@ -2622,7 +2622,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zellij"
|
name = "zellij"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"insta",
|
"insta",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -2636,7 +2636,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zellij-client"
|
name = "zellij-client"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"insta",
|
"insta",
|
||||||
"log",
|
"log",
|
||||||
|
|
@ -2647,7 +2647,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zellij-server"
|
name = "zellij-server"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.12.1",
|
"ansi_term 0.12.1",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|
@ -2667,7 +2667,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zellij-tile"
|
name = "zellij-tile"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
@ -2677,14 +2677,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zellij-tile-utils"
|
name = "zellij-tile-utils"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.12.1",
|
"ansi_term 0.12.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zellij-utils"
|
name = "zellij-utils"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"backtrace",
|
"backtrace",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "zellij"
|
name = "zellij"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
authors = ["Aram Drevekenin <aram@poor.dev>"]
|
authors = ["Aram Drevekenin <aram@poor.dev>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "A terminal workspace with batteries included"
|
description = "A terminal workspace with batteries included"
|
||||||
|
|
@ -14,9 +14,9 @@ resolver = "2"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
names = "0.11.0"
|
names = "0.11.0"
|
||||||
zellij-client = { path = "zellij-client/", version = "0.15.0" }
|
zellij-client = { path = "zellij-client/", version = "0.16.0" }
|
||||||
zellij-server = { path = "zellij-server/", version = "0.15.0" }
|
zellij-server = { path = "zellij-server/", version = "0.16.0" }
|
||||||
zellij-utils = { path = "zellij-utils/", version = "0.15.0" }
|
zellij-utils = { path = "zellij-utils/", version = "0.16.0" }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ run_task = "publish-zellij"
|
||||||
[tasks.release-commit]
|
[tasks.release-commit]
|
||||||
dependencies = ["commit-all", "tag-release"]
|
dependencies = ["commit-all", "tag-release"]
|
||||||
command = "git"
|
command = "git"
|
||||||
args = ["push", "--atomic", "upstream", "main", "v${CARGO_MAKE_CRATE_VERSION}"]
|
args = ["push", "--atomic", "origin", "main", "v${CARGO_MAKE_CRATE_VERSION}"]
|
||||||
|
|
||||||
[tasks.commit-all]
|
[tasks.commit-all]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
|
||||||
20
example/run_htop_layout.yaml
Normal file
20
example/run_htop_layout.yaml
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
direction: Vertical
|
||||||
|
parts:
|
||||||
|
- direction: Horizontal
|
||||||
|
split_size:
|
||||||
|
Percent: 50
|
||||||
|
parts:
|
||||||
|
- direction: Vertical
|
||||||
|
split_size:
|
||||||
|
Percent: 50
|
||||||
|
- direction: Vertical
|
||||||
|
split_size:
|
||||||
|
Percent: 50
|
||||||
|
run:
|
||||||
|
command: {cmd: htop}
|
||||||
|
- direction: Horizontal
|
||||||
|
split_size:
|
||||||
|
Percent: 50
|
||||||
|
run:
|
||||||
|
command: {cmd: htop}
|
||||||
30
example/run_htop_layout_with_plugins.yaml
Normal file
30
example/run_htop_layout_with_plugins.yaml
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
direction: Horizontal
|
||||||
|
parts:
|
||||||
|
- direction: Vertical
|
||||||
|
split_size:
|
||||||
|
Fixed: 1
|
||||||
|
run:
|
||||||
|
plugin: tab-bar
|
||||||
|
- direction: Vertical
|
||||||
|
parts:
|
||||||
|
- direction: Vertical
|
||||||
|
parts:
|
||||||
|
- direction: Vertical
|
||||||
|
split_size:
|
||||||
|
Percent: 50
|
||||||
|
run:
|
||||||
|
command: {cmd: htop}
|
||||||
|
- direction: Vertical
|
||||||
|
split_size:
|
||||||
|
Percent: 50
|
||||||
|
run:
|
||||||
|
command: {cmd: htop, args: ["-C"]}
|
||||||
|
- direction: Vertical
|
||||||
|
split_size:
|
||||||
|
Fixed: 5
|
||||||
|
- direction: Vertical
|
||||||
|
split_size:
|
||||||
|
Fixed: 2
|
||||||
|
run:
|
||||||
|
plugin: status-bar
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "zellij-client"
|
name = "zellij-client"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
authors = ["Kunal Mohan <kunalmohan99@gmail.com>"]
|
authors = ["Kunal Mohan <kunalmohan99@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "The client-side library for Zellij"
|
description = "The client-side library for Zellij"
|
||||||
|
|
@ -11,9 +11,10 @@ license = "MIT"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
mio = "0.7.11"
|
mio = "0.7.11"
|
||||||
termbg = "0.2.3"
|
termbg = "0.2.3"
|
||||||
zellij-utils = { path = "../zellij-utils/", version = "0.15.0" }
|
zellij-utils = { path = "../zellij-utils/", version = "0.16.0" }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = "1.6.0"
|
insta = "1.6.0"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,8 @@ pub fn start_client(
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let on_force_close = config_options.on_force_close.unwrap_or_default();
|
||||||
|
|
||||||
let _stdin_thread = thread::Builder::new()
|
let _stdin_thread = thread::Builder::new()
|
||||||
.name("stdin_handler".to_string())
|
.name("stdin_handler".to_string())
|
||||||
.spawn({
|
.spawn({
|
||||||
|
|
@ -202,7 +204,7 @@ pub fn start_client(
|
||||||
Box::new({
|
Box::new({
|
||||||
let os_api = os_input.clone();
|
let os_api = os_input.clone();
|
||||||
move || {
|
move || {
|
||||||
os_api.send_to_server(ClientToServerMsg::Action(Action::Detach));
|
os_api.send_to_server(ClientToServerMsg::Action(on_force_close.into()));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "zellij-server"
|
name = "zellij-server"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
authors = ["Kunal Mohan <kunalmohan99@gmail.com>"]
|
authors = ["Kunal Mohan <kunalmohan99@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "The server-side library for Zellij"
|
description = "The server-side library for Zellij"
|
||||||
|
|
@ -18,11 +18,12 @@ unicode-width = "0.1.8"
|
||||||
wasmer = "1.0.0"
|
wasmer = "1.0.0"
|
||||||
wasmer-wasi = "1.0.0"
|
wasmer-wasi = "1.0.0"
|
||||||
cassowary = "0.3.0"
|
cassowary = "0.3.0"
|
||||||
zellij-utils = { path = "../zellij-utils/", version = "0.15.0" }
|
zellij-utils = { path = "../zellij-utils/", version = "0.16.0" }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
typetag = "0.1.7"
|
typetag = "0.1.7"
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = "1.6.0"
|
insta = "1.6.0"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,13 +196,13 @@ impl Pane for PluginPane {
|
||||||
self.position_and_size.y -= count;
|
self.position_and_size.y -= count;
|
||||||
}
|
}
|
||||||
fn scroll_up(&mut self, _count: usize) {
|
fn scroll_up(&mut self, _count: usize) {
|
||||||
unimplemented!()
|
//unimplemented!()
|
||||||
}
|
}
|
||||||
fn scroll_down(&mut self, _count: usize) {
|
fn scroll_down(&mut self, _count: usize) {
|
||||||
unimplemented!()
|
//unimplemented!()
|
||||||
}
|
}
|
||||||
fn clear_scroll(&mut self) {
|
fn clear_scroll(&mut self) {
|
||||||
unimplemented!()
|
//unimplemented!()
|
||||||
}
|
}
|
||||||
// FIXME: This need to be reevaluated and deleted if possible.
|
// FIXME: This need to be reevaluated and deleted if possible.
|
||||||
// `max` doesn't make sense when things are fixed...
|
// `max` doesn't make sense when things are fixed...
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,3 @@
|
||||||
use zellij_utils::async_std;
|
|
||||||
|
|
||||||
use async_std::future::timeout as async_timeout;
|
|
||||||
use async_std::task::{self, JoinHandle};
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::os::unix::io::RawFd;
|
|
||||||
use std::time::{Duration, Instant};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
os_input_output::{AsyncReader, Pid, ServerOsApi},
|
os_input_output::{AsyncReader, Pid, ServerOsApi},
|
||||||
panes::PaneId,
|
panes::PaneId,
|
||||||
|
|
@ -14,9 +6,22 @@ use crate::{
|
||||||
wasm_vm::PluginInstruction,
|
wasm_vm::PluginInstruction,
|
||||||
ServerInstruction,
|
ServerInstruction,
|
||||||
};
|
};
|
||||||
|
use async_std::{
|
||||||
|
future::timeout as async_timeout,
|
||||||
|
task::{self, JoinHandle},
|
||||||
|
};
|
||||||
|
use std::{
|
||||||
|
collections::HashMap,
|
||||||
|
os::unix::io::RawFd,
|
||||||
|
time::{Duration, Instant},
|
||||||
|
};
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
|
async_std,
|
||||||
errors::{get_current_ctx, ContextType, PtyContext},
|
errors::{get_current_ctx, ContextType, PtyContext},
|
||||||
input::{command::TerminalAction, layout::Layout},
|
input::{
|
||||||
|
command::TerminalAction,
|
||||||
|
layout::{Layout, Run},
|
||||||
|
},
|
||||||
logging::debug_to_file,
|
logging::debug_to_file,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -236,19 +241,36 @@ impl Pty {
|
||||||
pub fn spawn_terminals_for_layout(
|
pub fn spawn_terminals_for_layout(
|
||||||
&mut self,
|
&mut self,
|
||||||
layout: Layout,
|
layout: Layout,
|
||||||
terminal_action: Option<TerminalAction>,
|
default_shell: Option<TerminalAction>,
|
||||||
) {
|
) {
|
||||||
let total_panes = layout.total_terminal_panes();
|
let extracted_run_instructions = layout.extract_run_instructions();
|
||||||
let mut new_pane_pids = vec![];
|
let mut new_pane_pids = vec![];
|
||||||
for _ in 0..total_panes {
|
for run_instruction in extracted_run_instructions {
|
||||||
let (pid_primary, pid_secondary): (RawFd, Pid) = self
|
match run_instruction {
|
||||||
.bus
|
Some(Run::Command(command)) => {
|
||||||
.os_input
|
let cmd = TerminalAction::RunCommand(command);
|
||||||
.as_mut()
|
let (pid_primary, pid_secondary): (RawFd, Pid) = self
|
||||||
.unwrap()
|
.bus
|
||||||
.spawn_terminal(terminal_action.clone());
|
.os_input
|
||||||
self.id_to_child_pid.insert(pid_primary, pid_secondary);
|
.as_mut()
|
||||||
new_pane_pids.push(pid_primary);
|
.unwrap()
|
||||||
|
.spawn_terminal(Some(cmd));
|
||||||
|
self.id_to_child_pid.insert(pid_primary, pid_secondary);
|
||||||
|
new_pane_pids.push(pid_primary);
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
let (pid_primary, pid_secondary): (RawFd, Pid) = self
|
||||||
|
.bus
|
||||||
|
.os_input
|
||||||
|
.as_mut()
|
||||||
|
.unwrap()
|
||||||
|
.spawn_terminal(default_shell.clone());
|
||||||
|
self.id_to_child_pid.insert(pid_primary, pid_secondary);
|
||||||
|
new_pane_pids.push(pid_primary);
|
||||||
|
}
|
||||||
|
// Investigate moving plugin loading to here.
|
||||||
|
Some(Run::Plugin(_)) => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.bus
|
self.bus
|
||||||
.senders
|
.senders
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use crate::{
|
||||||
wasm_vm::PluginInstruction,
|
wasm_vm::PluginInstruction,
|
||||||
ServerInstruction, SessionState,
|
ServerInstruction, SessionState,
|
||||||
};
|
};
|
||||||
use zellij_tile::data::{Event, InputMode, ModeInfo, Palette, PluginCapabilities, TabInfo};
|
use zellij_tile::data::{Event, ModeInfo, Palette, PluginCapabilities, TabInfo};
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
errors::{ContextType, ScreenContext},
|
errors::{ContextType, ScreenContext},
|
||||||
input::options::Options,
|
input::options::Options,
|
||||||
|
|
@ -149,7 +149,6 @@ pub(crate) struct Screen {
|
||||||
/// The index of this [`Screen`]'s active [`Tab`].
|
/// The index of this [`Screen`]'s active [`Tab`].
|
||||||
active_tab_index: Option<usize>,
|
active_tab_index: Option<usize>,
|
||||||
mode_info: ModeInfo,
|
mode_info: ModeInfo,
|
||||||
input_mode: InputMode,
|
|
||||||
colors: Palette,
|
colors: Palette,
|
||||||
session_state: Arc<RwLock<SessionState>>,
|
session_state: Arc<RwLock<SessionState>>,
|
||||||
}
|
}
|
||||||
|
|
@ -161,7 +160,6 @@ impl Screen {
|
||||||
client_attributes: &ClientAttributes,
|
client_attributes: &ClientAttributes,
|
||||||
max_panes: Option<usize>,
|
max_panes: Option<usize>,
|
||||||
mode_info: ModeInfo,
|
mode_info: ModeInfo,
|
||||||
input_mode: InputMode,
|
|
||||||
session_state: Arc<RwLock<SessionState>>,
|
session_state: Arc<RwLock<SessionState>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Screen {
|
Screen {
|
||||||
|
|
@ -172,7 +170,6 @@ impl Screen {
|
||||||
active_tab_index: None,
|
active_tab_index: None,
|
||||||
tabs: BTreeMap::new(),
|
tabs: BTreeMap::new(),
|
||||||
mode_info,
|
mode_info,
|
||||||
input_mode,
|
|
||||||
session_state,
|
session_state,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -192,7 +189,6 @@ impl Screen {
|
||||||
self.max_panes,
|
self.max_panes,
|
||||||
Some(PaneId::Terminal(pane_id)),
|
Some(PaneId::Terminal(pane_id)),
|
||||||
self.mode_info.clone(),
|
self.mode_info.clone(),
|
||||||
self.input_mode,
|
|
||||||
self.colors,
|
self.colors,
|
||||||
self.session_state.clone(),
|
self.session_state.clone(),
|
||||||
);
|
);
|
||||||
|
|
@ -354,7 +350,6 @@ impl Screen {
|
||||||
self.max_panes,
|
self.max_panes,
|
||||||
None,
|
None,
|
||||||
self.mode_info.clone(),
|
self.mode_info.clone(),
|
||||||
self.input_mode,
|
|
||||||
self.colors,
|
self.colors,
|
||||||
self.session_state.clone(),
|
self.session_state.clone(),
|
||||||
);
|
);
|
||||||
|
|
@ -428,7 +423,6 @@ pub(crate) fn screen_thread_main(
|
||||||
session_state: Arc<RwLock<SessionState>>,
|
session_state: Arc<RwLock<SessionState>>,
|
||||||
) {
|
) {
|
||||||
let capabilities = config_options.simplified_ui;
|
let capabilities = config_options.simplified_ui;
|
||||||
let default_mode = config_options.default_mode.unwrap_or_default();
|
|
||||||
|
|
||||||
let mut screen = Screen::new(
|
let mut screen = Screen::new(
|
||||||
bus,
|
bus,
|
||||||
|
|
@ -439,10 +433,8 @@ pub(crate) fn screen_thread_main(
|
||||||
capabilities: PluginCapabilities {
|
capabilities: PluginCapabilities {
|
||||||
arrow_fonts: capabilities,
|
arrow_fonts: capabilities,
|
||||||
},
|
},
|
||||||
mode: default_mode,
|
|
||||||
..ModeInfo::default()
|
..ModeInfo::default()
|
||||||
},
|
},
|
||||||
default_mode,
|
|
||||||
session_state,
|
session_state,
|
||||||
);
|
);
|
||||||
loop {
|
loop {
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,12 @@ use std::{
|
||||||
cmp::Reverse,
|
cmp::Reverse,
|
||||||
collections::{BTreeMap, HashSet},
|
collections::{BTreeMap, HashSet},
|
||||||
};
|
};
|
||||||
use zellij_tile::data::{Event, InputMode, ModeInfo, Palette};
|
use zellij_tile::data::{Event, ModeInfo, Palette};
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
input::{layout::Layout, parse_keys},
|
input::{
|
||||||
|
layout::{Layout, Run},
|
||||||
|
parse_keys,
|
||||||
|
},
|
||||||
pane_size::PositionAndSize,
|
pane_size::PositionAndSize,
|
||||||
shared::adjust_to_size,
|
shared::adjust_to_size,
|
||||||
};
|
};
|
||||||
|
|
@ -84,7 +87,6 @@ pub(crate) struct Tab {
|
||||||
should_clear_display_before_rendering: bool,
|
should_clear_display_before_rendering: bool,
|
||||||
session_state: Arc<RwLock<SessionState>>,
|
session_state: Arc<RwLock<SessionState>>,
|
||||||
pub mode_info: ModeInfo,
|
pub mode_info: ModeInfo,
|
||||||
pub input_mode: InputMode,
|
|
||||||
pub colors: Palette,
|
pub colors: Palette,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +98,6 @@ pub(crate) struct TabData {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub active: bool,
|
pub active: bool,
|
||||||
pub mode_info: ModeInfo,
|
pub mode_info: ModeInfo,
|
||||||
pub input_mode: InputMode,
|
|
||||||
pub colors: Palette,
|
pub colors: Palette,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,7 +258,6 @@ impl Tab {
|
||||||
max_panes: Option<usize>,
|
max_panes: Option<usize>,
|
||||||
pane_id: Option<PaneId>,
|
pane_id: Option<PaneId>,
|
||||||
mode_info: ModeInfo,
|
mode_info: ModeInfo,
|
||||||
input_mode: InputMode,
|
|
||||||
colors: Palette,
|
colors: Palette,
|
||||||
session_state: Arc<RwLock<SessionState>>,
|
session_state: Arc<RwLock<SessionState>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
|
@ -296,7 +296,6 @@ impl Tab {
|
||||||
senders,
|
senders,
|
||||||
should_clear_display_before_rendering: false,
|
should_clear_display_before_rendering: false,
|
||||||
mode_info,
|
mode_info,
|
||||||
input_mode,
|
|
||||||
colors,
|
colors,
|
||||||
session_state,
|
session_state,
|
||||||
}
|
}
|
||||||
|
|
@ -338,7 +337,7 @@ impl Tab {
|
||||||
let mut new_pids = new_pids.iter();
|
let mut new_pids = new_pids.iter();
|
||||||
for (layout, position_and_size) in positions_and_size {
|
for (layout, position_and_size) in positions_and_size {
|
||||||
// A plugin pane
|
// A plugin pane
|
||||||
if let Some(plugin) = &layout.plugin {
|
if let Some(Run::Plugin(Some(plugin))) = &layout.run {
|
||||||
let (pid_tx, pid_rx) = channel();
|
let (pid_tx, pid_rx) = channel();
|
||||||
self.senders
|
self.senders
|
||||||
.send_to_plugin(PluginInstruction::Load(pid_tx, plugin.clone()))
|
.send_to_plugin(PluginInstruction::Load(pid_tx, plugin.clone()))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use super::{Screen, ScreenInstruction};
|
use super::{Screen, ScreenInstruction};
|
||||||
use crate::zellij_tile::data::{InputMode, ModeInfo, Palette};
|
use crate::zellij_tile::data::{ModeInfo, Palette};
|
||||||
use crate::{
|
use crate::{
|
||||||
os_input_output::{AsyncReader, Pid, ServerOsApi},
|
os_input_output::{AsyncReader, Pid, ServerOsApi},
|
||||||
thread_bus::Bus,
|
thread_bus::Bus,
|
||||||
|
|
@ -81,16 +81,8 @@ fn create_new_screen(position_and_size: PositionAndSize) -> Screen {
|
||||||
client_attributes.position_and_size = position_and_size;
|
client_attributes.position_and_size = position_and_size;
|
||||||
let max_panes = None;
|
let max_panes = None;
|
||||||
let mode_info = ModeInfo::default();
|
let mode_info = ModeInfo::default();
|
||||||
let input_mode = InputMode::Normal;
|
|
||||||
let session_state = Arc::new(RwLock::new(SessionState::Attached));
|
let session_state = Arc::new(RwLock::new(SessionState::Attached));
|
||||||
Screen::new(
|
Screen::new(bus, &client_attributes, max_panes, mode_info, session_state)
|
||||||
bus,
|
|
||||||
&client_attributes,
|
|
||||||
max_panes,
|
|
||||||
mode_info,
|
|
||||||
input_mode,
|
|
||||||
session_state,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use super::Tab;
|
use super::Tab;
|
||||||
use crate::zellij_tile::data::{InputMode, ModeInfo, Palette};
|
use crate::zellij_tile::data::{ModeInfo, Palette};
|
||||||
use crate::{
|
use crate::{
|
||||||
os_input_output::{AsyncReader, Pid, ServerOsApi},
|
os_input_output::{AsyncReader, Pid, ServerOsApi},
|
||||||
panes::PaneId,
|
panes::PaneId,
|
||||||
|
|
@ -82,7 +82,6 @@ fn create_new_tab(position_and_size: PositionAndSize) -> Tab {
|
||||||
let max_panes = None;
|
let max_panes = None;
|
||||||
let first_pane_id = Some(PaneId::Terminal(1));
|
let first_pane_id = Some(PaneId::Terminal(1));
|
||||||
let mode_info = ModeInfo::default();
|
let mode_info = ModeInfo::default();
|
||||||
let input_mode = InputMode::Normal;
|
|
||||||
let colors = Palette::default();
|
let colors = Palette::default();
|
||||||
let session_state = Arc::new(RwLock::new(SessionState::Attached));
|
let session_state = Arc::new(RwLock::new(SessionState::Attached));
|
||||||
Tab::new(
|
Tab::new(
|
||||||
|
|
@ -95,7 +94,6 @@ fn create_new_tab(position_and_size: PositionAndSize) -> Tab {
|
||||||
max_panes,
|
max_panes,
|
||||||
first_pane_id,
|
first_pane_id,
|
||||||
mode_info,
|
mode_info,
|
||||||
input_mode,
|
|
||||||
colors,
|
colors,
|
||||||
session_state,
|
session_state,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "zellij-tile-utils"
|
name = "zellij-tile-utils"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
authors = ["denis <denismaximov98@gmail.com>"]
|
authors = ["denis <denismaximov98@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "A utility library for Zellij plugins"
|
description = "A utility library for Zellij plugins"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "zellij-tile"
|
name = "zellij-tile"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
authors = ["Brooks J Rady <b.j.rady@gmail.com>"]
|
authors = ["Brooks J Rady <b.j.rady@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "A small client-side library for writing Zellij plugins"
|
description = "A small client-side library for writing Zellij plugins"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "zellij-utils"
|
name = "zellij-utils"
|
||||||
version = "0.15.0"
|
version = "0.16.0"
|
||||||
authors = ["Kunal Mohan <kunalmohan99@gmail.com>"]
|
authors = ["Kunal Mohan <kunalmohan99@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "A utility library for Zellij client and server"
|
description = "A utility library for Zellij client and server"
|
||||||
|
|
@ -27,7 +27,7 @@ structopt = "0.3"
|
||||||
strum = "0.20.0"
|
strum = "0.20.0"
|
||||||
termion = "1.5.0"
|
termion = "1.5.0"
|
||||||
vte = "0.10.1"
|
vte = "0.10.1"
|
||||||
zellij-tile = { path = "../zellij-tile/", version = "0.15.0" }
|
zellij-tile = { path = "../zellij-tile/", version = "0.16.0" }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
log4rs = "1.0.0"
|
log4rs = "1.0.0"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,3 +240,10 @@ keybinds:
|
||||||
key: [Ctrl: 'q',]
|
key: [Ctrl: 'q',]
|
||||||
- action: [Detach,]
|
- action: [Detach,]
|
||||||
key: [Char: 'd',]
|
key: [Char: 'd',]
|
||||||
|
|
||||||
|
# Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP
|
||||||
|
# eg. when terminal window with an active zellij session is closed
|
||||||
|
# Options:
|
||||||
|
# - detach (Default)
|
||||||
|
# - quit
|
||||||
|
#on_force_close: quit
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,11 @@ parts:
|
||||||
- direction: Vertical
|
- direction: Vertical
|
||||||
split_size:
|
split_size:
|
||||||
Fixed: 1
|
Fixed: 1
|
||||||
plugin: tab-bar
|
run:
|
||||||
|
plugin: tab-bar
|
||||||
- direction: Vertical
|
- direction: Vertical
|
||||||
- direction: Vertical
|
- direction: Vertical
|
||||||
split_size:
|
split_size:
|
||||||
Fixed: 2
|
Fixed: 2
|
||||||
plugin: status-bar
|
run:
|
||||||
|
plugin: status-bar
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,6 @@ parts:
|
||||||
- direction: Vertical
|
- direction: Vertical
|
||||||
split_size:
|
split_size:
|
||||||
Fixed: 1
|
Fixed: 1
|
||||||
plugin: tab-bar
|
run:
|
||||||
|
plugin: tab-bar
|
||||||
- direction: Vertical
|
- direction: Vertical
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,18 @@ parts:
|
||||||
- direction: Vertical
|
- direction: Vertical
|
||||||
split_size:
|
split_size:
|
||||||
Fixed: 1
|
Fixed: 1
|
||||||
plugin: tab-bar
|
run:
|
||||||
|
plugin: tab-bar
|
||||||
- direction: Vertical
|
- direction: Vertical
|
||||||
parts:
|
parts:
|
||||||
- direction: Horizontal
|
- direction: Horizontal
|
||||||
split_size:
|
split_size:
|
||||||
Percent: 20
|
Percent: 20
|
||||||
plugin: strider
|
run:
|
||||||
|
plugin: strider
|
||||||
- direction: Horizontal
|
- direction: Horizontal
|
||||||
- direction: Vertical
|
- direction: Vertical
|
||||||
split_size:
|
split_size:
|
||||||
Fixed: 2
|
Fixed: 2
|
||||||
plugin: status-bar
|
run:
|
||||||
|
plugin: status-bar
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
//! Definition of the actions that can be bound to keys.
|
//! Definition of the actions that can be bound to keys.
|
||||||
|
|
||||||
use super::command::RunCommandAction;
|
use super::command::RunCommandAction;
|
||||||
|
use crate::input::options::OnForceClose;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use zellij_tile::data::InputMode;
|
use zellij_tile::data::InputMode;
|
||||||
|
|
||||||
|
|
@ -81,3 +82,12 @@ pub enum Action {
|
||||||
MouseHold(Position),
|
MouseHold(Position),
|
||||||
Copy,
|
Copy,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<OnForceClose> for Action {
|
||||||
|
fn from(ofc: OnForceClose) -> Action {
|
||||||
|
match ofc {
|
||||||
|
OnForceClose::Quit => Action::Quit,
|
||||||
|
OnForceClose::Detach => Action::Detach,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ pub enum TerminalAction {
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Default, Serialize, PartialEq, Eq)]
|
#[derive(Clone, Debug, Deserialize, Default, Serialize, PartialEq, Eq)]
|
||||||
pub struct RunCommand {
|
pub struct RunCommand {
|
||||||
|
#[serde(alias = "cmd")]
|
||||||
pub command: PathBuf,
|
pub command: PathBuf,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub args: Vec<String>,
|
pub args: Vec<String>,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,11 @@
|
||||||
// place.
|
// place.
|
||||||
// If plugins should be able to depend on the layout system
|
// If plugins should be able to depend on the layout system
|
||||||
// then [`zellij-utils`] could be a proper place.
|
// then [`zellij-utils`] could be a proper place.
|
||||||
use crate::{input::config::ConfigError, pane_size::PositionAndSize, setup};
|
use crate::{
|
||||||
|
input::{command::RunCommand, config::ConfigError},
|
||||||
|
pane_size::PositionAndSize,
|
||||||
|
setup,
|
||||||
|
};
|
||||||
use crate::{serde, serde_yaml};
|
use crate::{serde, serde_yaml};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
@ -29,6 +33,15 @@ pub enum SplitSize {
|
||||||
Fixed(u16), // An absolute number of columns or rows
|
Fixed(u16), // An absolute number of columns or rows
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
#[serde(crate = "self::serde")]
|
||||||
|
pub enum Run {
|
||||||
|
#[serde(rename = "plugin")]
|
||||||
|
Plugin(Option<PathBuf>),
|
||||||
|
#[serde(rename = "command")]
|
||||||
|
Command(RunCommand),
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[serde(crate = "self::serde")]
|
#[serde(crate = "self::serde")]
|
||||||
pub struct Layout {
|
pub struct Layout {
|
||||||
|
|
@ -36,7 +49,7 @@ pub struct Layout {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub parts: Vec<Layout>,
|
pub parts: Vec<Layout>,
|
||||||
pub split_size: Option<SplitSize>,
|
pub split_size: Option<SplitSize>,
|
||||||
pub plugin: Option<PathBuf>,
|
pub run: Option<Run>,
|
||||||
}
|
}
|
||||||
|
|
||||||
type LayoutResult = Result<Layout, ConfigError>;
|
type LayoutResult = Result<Layout, ConfigError>;
|
||||||
|
|
@ -127,13 +140,28 @@ impl Layout {
|
||||||
let mut total_panes = 0;
|
let mut total_panes = 0;
|
||||||
total_panes += self.parts.len();
|
total_panes += self.parts.len();
|
||||||
for part in self.parts.iter() {
|
for part in self.parts.iter() {
|
||||||
if part.plugin.is_none() {
|
match part.run {
|
||||||
total_panes += part.total_terminal_panes();
|
Some(Run::Command(_)) | None => {
|
||||||
|
total_panes += part.total_terminal_panes();
|
||||||
|
}
|
||||||
|
Some(Run::Plugin(_)) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
total_panes
|
total_panes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn extract_run_instructions(&self) -> Vec<Option<Run>> {
|
||||||
|
let mut run_instructions = vec![];
|
||||||
|
if self.parts.is_empty() {
|
||||||
|
run_instructions.push(self.run.clone());
|
||||||
|
}
|
||||||
|
for part in self.parts.iter() {
|
||||||
|
let mut current_runnables = part.extract_run_instructions();
|
||||||
|
run_instructions.append(&mut current_runnables);
|
||||||
|
}
|
||||||
|
run_instructions
|
||||||
|
}
|
||||||
|
|
||||||
pub fn position_panes_in_space(
|
pub fn position_panes_in_space(
|
||||||
&self,
|
&self,
|
||||||
space: &PositionAndSize,
|
space: &PositionAndSize,
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,39 @@
|
||||||
use crate::cli::Command;
|
use crate::cli::Command;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use std::str::FromStr;
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use zellij_tile::data::InputMode;
|
use zellij_tile::data::InputMode;
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Debug, PartialEq, Deserialize, Serialize)]
|
||||||
|
pub enum OnForceClose {
|
||||||
|
#[serde(alias = "quit")]
|
||||||
|
Quit,
|
||||||
|
#[serde(alias = "detach")]
|
||||||
|
Detach,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for OnForceClose {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::Detach
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for OnForceClose {
|
||||||
|
type Err = Box<dyn std::error::Error>;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
match s {
|
||||||
|
"quit" => Ok(Self::Quit),
|
||||||
|
"detach" => Ok(Self::Detach),
|
||||||
|
e => Err(e.to_string().into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Deserialize, Serialize, StructOpt)]
|
#[derive(Clone, Default, Debug, PartialEq, Deserialize, Serialize, StructOpt)]
|
||||||
/// Options that can be set either through the config file,
|
/// Options that can be set either through the config file,
|
||||||
/// or cli flags
|
/// or cli flags - cli flags should take precedence over the config file
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
/// Allow plugins to use a more simplified layout
|
/// Allow plugins to use a more simplified layout
|
||||||
/// that is compatible with more fonts
|
/// that is compatible with more fonts
|
||||||
|
|
@ -29,7 +56,11 @@ pub struct Options {
|
||||||
pub layout_dir: Option<PathBuf>,
|
pub layout_dir: Option<PathBuf>,
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
/// Disable handling of mouse events
|
||||||
pub disable_mouse_mode: bool,
|
pub disable_mouse_mode: bool,
|
||||||
|
/// Set behaviour on force close (quit or detach)
|
||||||
|
#[structopt(long)]
|
||||||
|
pub on_force_close: Option<OnForceClose>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Options {
|
impl Options {
|
||||||
|
|
@ -45,37 +76,16 @@ impl Options {
|
||||||
/// will supercede a `Some` in `self`
|
/// will supercede a `Some` in `self`
|
||||||
// TODO: Maybe a good candidate for a macro?
|
// TODO: Maybe a good candidate for a macro?
|
||||||
pub fn merge(&self, other: Options) -> Options {
|
pub fn merge(&self, other: Options) -> Options {
|
||||||
let simplified_ui = if other.simplified_ui {
|
let merge_bool = |opt_other, opt_self| if opt_other { true } else { opt_self };
|
||||||
true
|
|
||||||
} else {
|
|
||||||
self.simplified_ui
|
|
||||||
};
|
|
||||||
|
|
||||||
let default_mode = match other.default_mode {
|
let simplified_ui = merge_bool(other.simplified_ui, self.simplified_ui);
|
||||||
None => self.default_mode,
|
let disable_mouse_mode = merge_bool(other.disable_mouse_mode, self.disable_mouse_mode);
|
||||||
other => other,
|
|
||||||
};
|
|
||||||
|
|
||||||
let default_shell = match other.default_shell {
|
let default_mode = other.default_mode.or(self.default_mode);
|
||||||
None => self.default_shell.clone(),
|
let default_shell = other.default_shell.or_else(|| self.default_shell.clone());
|
||||||
other => other,
|
let layout_dir = other.layout_dir.or_else(|| self.layout_dir.clone());
|
||||||
};
|
let theme = other.theme.or_else(|| self.theme.clone());
|
||||||
|
let on_force_close = other.on_force_close.or(self.on_force_close);
|
||||||
let layout_dir = match other.layout_dir {
|
|
||||||
None => self.layout_dir.clone(),
|
|
||||||
other => other,
|
|
||||||
};
|
|
||||||
|
|
||||||
let theme = match other.theme {
|
|
||||||
None => self.theme.clone(),
|
|
||||||
other => other,
|
|
||||||
};
|
|
||||||
|
|
||||||
let disable_mouse_mode = if other.disable_mouse_mode {
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
self.disable_mouse_mode
|
|
||||||
};
|
|
||||||
|
|
||||||
Options {
|
Options {
|
||||||
simplified_ui,
|
simplified_ui,
|
||||||
|
|
@ -84,6 +94,7 @@ impl Options {
|
||||||
default_shell,
|
default_shell,
|
||||||
layout_dir,
|
layout_dir,
|
||||||
disable_mouse_mode,
|
disable_mouse_mode,
|
||||||
|
on_force_close,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue