aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorDaniel Jankowski <daniel.jankowski@rub.de>2023-09-06 13:36:03 +0200
committerDaniel Jankowski <daniel.jankowski@rub.de>2023-09-06 13:36:03 +0200
commita203df979b584d41dcf3dceb551d6cc884f4c5e3 (patch)
tree52cca48deba36dd97e26ca4048d843db1978f54e /src/main.rs
parentchore: update cargo dependencies (diff)
downloadsl0pstatus-a203df979b584d41dcf3dceb551d6cc884f4c5e3.tar.gz
sl0pstatus-a203df979b584d41dcf3dceb551d6cc884f4c5e3.tar.xz
sl0pstatus-a203df979b584d41dcf3dceb551d6cc884f4c5e3.zip
feat: implement clickable tabs
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 41ffb09..ef189ce 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -22,6 +22,7 @@ struct State {
#[derive(Default, Debug, Clone)]
pub struct ZellijState {
+ pub cols: usize,
pub mode: ModeInfo,
pub tabs: Vec<TabInfo>,
pub sessions: Vec<SessionInfo>,
@@ -41,6 +42,7 @@ impl ZellijPlugin for State {
PermissionType::RunCommands,
]);
subscribe(&[
+ EventType::Mouse,
EventType::ModeUpdate,
EventType::PaneUpdate,
EventType::PermissionRequestResult,
@@ -53,6 +55,7 @@ impl ZellijPlugin for State {
self.widget_map = register_widgets(configuration);
self.state = ZellijState {
+ cols: 0,
mode: ModeInfo::default(),
tabs: Vec::new(),
sessions: Vec::new(),
@@ -62,6 +65,10 @@ impl ZellijPlugin for State {
fn update(&mut self, event: Event) -> bool {
let mut should_render = false;
match event {
+ Event::Mouse(mouse_info) => {
+ self.module_config
+ .handle_mouse_action(self.state.clone(), mouse_info, self.widget_map.clone());
+ }
Event::ModeUpdate(mode_info) => {
self.state.mode = mode_info;
should_render = true;
@@ -107,8 +114,9 @@ impl ZellijPlugin for State {
}
fn render(&mut self, _rows: usize, cols: usize) {
+ self.state.cols = cols;
self.module_config
- .render_bar(self.state.clone(), self.widget_map.clone(), cols);
+ .render_bar(self.state.clone(), self.widget_map.clone());
}
}