aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/plugin_api/event.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-06-10 16:50:55 +0200
committerGitHub <noreply@github.com>2026-06-10 16:50:55 +0200
commitb6a5ad0e5a93d9f584b3f7a0fc90f497a09cbdb0 (patch)
tree38c77a381cfb937b428752a588c09a45c81434c9 /zellij-utils/src/plugin_api/event.rs
parentfeat: PWA support for the web client (#5184) (diff)
downloadsl0ppij-b6a5ad0e5a93d9f584b3f7a0fc90f497a09cbdb0.tar.gz
sl0ppij-b6a5ad0e5a93d9f584b3f7a0fc90f497a09cbdb0.tar.xz
sl0ppij-b6a5ad0e5a93d9f584b3f7a0fc90f497a09cbdb0.zip
Mobile layout (#5241)
* phase 2+3 * initial mobile plugin (phases 4 + 5 + 6) * some bugfixes * implement stage 7 * mobile interface improvements * improve mobile pane/tab picker * more ui improvements and fixes * various mobile fixes * some mobile fixes * mobile keyboard triggering fix * some cleanups * initial plugin keyboard implementation * improve keyboard hit zones * improve keyboard * pinch resize * pinching fixes * implement scrolling + panning * initial keyboard resizing * fix: mobile first render issues * keyboard responsiveness * fix some issues with the keyboard * implement fit * fix mobile scrolling * add tilde cell to compact * improve mobile keyboard * fix starting mobile terminal font to natural keyboard size * fix mobile resize blank screen flash * shadow focus for mobile * more keyboard fixes * improve mobile status bar * fix: render plugins to mobile clients * allow opening new panes/tabs from the mobile plugin * allow configuring * fix dot slash * improve mobile native soft keyboard interaction * switch to native keyboard - initial implementation * dirty hacks, but phone keyboard works now * adjust keyboard help strip * fix cursor in mobile * fix keyboard and help line * rename keyboard to modifier bar * allow starting new session * make clicking session name bring us to new session menu * allow switching to desktop from the mobile ui * mobile welcome screen initial implementation * mobile welcome screen fixes * various welcome screen fixes * more mobile fixes * moar mobile fixes * mobile ui redesign * fix: swallowed backspace bug * switch session screen improvement * touch up some interfaces * refactor: move mobile state to own struct * refactor: move fit resizing to the server * remove dead flash code * some cleanups * refactor: clear fit on close * refactor: improve fit api * refactor: pane sync functions * refactor: mouse * refactor: break into modules * some cleanups for the sessions screen * fix scrolling and other stuff * refactor: sessions screen * refactor: panes screen * refactor: new session screen * refactor: menu screen * refactor: render * cleanups * refactor: plugin structure * remove unused welcome screen path * Rename api * refactor input.js * cleanup useless comments * fit/mobile refactoring * take out the garbage * remove more comments * remove mobile flash on startup/attach * fix: various mobile startup issues * fix space bugs * cleanup * rustfmt * fix windows build * adjust modifier bar ui * add pr
Diffstat (limited to 'zellij-utils/src/plugin_api/event.rs')
-rw-r--r--zellij-utils/src/plugin_api/event.rs62
1 files changed, 62 insertions, 0 deletions
diff --git a/zellij-utils/src/plugin_api/event.rs b/zellij-utils/src/plugin_api/event.rs
index af421fac..5ba106d0 100644
--- a/zellij-utils/src/plugin_api/event.rs
+++ b/zellij-utils/src/plugin_api/event.rs
@@ -26,6 +26,7 @@ pub use super::generated_api::api::{
PluginConfigurationChangedPayload as ProtobufPluginConfigurationChangedPayload,
PluginInfo as ProtobufPluginInfo, ResurrectableSession as ProtobufResurrectableSession,
SelectedText as ProtobufSelectedText, SessionManifest as ProtobufSessionManifest,
+ SoftKeyboardVisibilityChangedPayload as ProtobufSoftKeyboardVisibilityChangedPayload,
SyntaxError as ProtobufSyntaxError, TabInfo as ProtobufTabInfo,
TabMetadata as ProtobufTabMetadata, UserActionPayload as ProtobufUserActionPayload,
WebServerStatusPayload as ProtobufWebServerStatusPayload, WebSharing as ProtobufWebSharing,
@@ -588,6 +589,14 @@ impl TryFrom<ProtobufEvent> for Event {
},
_ => Err("Malformed payload for HostTerminalThemeChanged Event"),
},
+ Some(ProtobufEventType::SoftKeyboardVisibilityChanged) => {
+ match protobuf_event.payload {
+ Some(ProtobufEventPayload::SoftKeyboardVisibilityChangedPayload(p)) => {
+ Ok(Event::SoftKeyboardVisibilityChanged(p.visible))
+ },
+ _ => Err("Malformed payload for SoftKeyboardVisibilityChanged Event"),
+ }
+ },
None => Err("Unknown Protobuf Event"),
}
}
@@ -1129,6 +1138,15 @@ impl TryFrom<Event> for ProtobufEvent {
payload: Some(event::Payload::HostTerminalThemeChangedPayload(payload)),
})
},
+ Event::SoftKeyboardVisibilityChanged(visible) => {
+ let payload = ProtobufSoftKeyboardVisibilityChangedPayload { visible };
+ Ok(ProtobufEvent {
+ name: ProtobufEventType::SoftKeyboardVisibilityChanged as i32,
+ payload: Some(event::Payload::SoftKeyboardVisibilityChangedPayload(
+ payload,
+ )),
+ })
+ },
Event::InitialKeybinds(keybinds) => {
let mut protobuf_keybinds: Vec<ProtobufInputModeKeybinds> = vec![];
for (input_mode, input_mode_keybinds) in keybinds {
@@ -1624,6 +1642,22 @@ impl TryFrom<MouseEventPayload> for Mouse {
),
_ => Err("Malformed payload for mouse hover"),
},
+ Some(MouseEventName::MouseScrollLeft) => {
+ match mouse_event_payload.mouse_event_payload {
+ Some(mouse_event_payload::MouseEventPayload::LineCount(line_count)) => {
+ Ok(Mouse::ScrollLeft(line_count as usize))
+ },
+ _ => Err("Malformed payload for mouse scroll left"),
+ }
+ },
+ Some(MouseEventName::MouseScrollRight) => {
+ match mouse_event_payload.mouse_event_payload {
+ Some(mouse_event_payload::MouseEventPayload::LineCount(line_count)) => {
+ Ok(Mouse::ScrollRight(line_count as usize))
+ },
+ _ => Err("Malformed payload for mouse scroll right"),
+ }
+ },
None => Err("Malformed payload for MouseEventName"),
}
}
@@ -1690,6 +1724,18 @@ impl TryFrom<Mouse> for MouseEventPayload {
},
)),
}),
+ Mouse::ScrollLeft(cols) => Ok(MouseEventPayload {
+ mouse_event_name: MouseEventName::MouseScrollLeft as i32,
+ mouse_event_payload: Some(mouse_event_payload::MouseEventPayload::LineCount(
+ cols as u32,
+ )),
+ }),
+ Mouse::ScrollRight(cols) => Ok(MouseEventPayload {
+ mouse_event_name: MouseEventName::MouseScrollRight as i32,
+ mouse_event_payload: Some(mouse_event_payload::MouseEventPayload::LineCount(
+ cols as u32,
+ )),
+ }),
}
}
}
@@ -2078,6 +2124,9 @@ impl TryFrom<ProtobufEventType> for EventType {
ProtobufEventType::HighlightClicked => EventType::HighlightClicked,
ProtobufEventType::InitialKeybinds => EventType::InitialKeybinds,
ProtobufEventType::HostTerminalThemeChanged => EventType::HostTerminalThemeChanged,
+ ProtobufEventType::SoftKeyboardVisibilityChanged => {
+ EventType::SoftKeyboardVisibilityChanged
+ },
})
}
}
@@ -2132,6 +2181,9 @@ impl TryFrom<EventType> for ProtobufEventType {
EventType::HighlightClicked => ProtobufEventType::HighlightClicked,
EventType::InitialKeybinds => ProtobufEventType::InitialKeybinds,
EventType::HostTerminalThemeChanged => ProtobufEventType::HostTerminalThemeChanged,
+ EventType::SoftKeyboardVisibilityChanged => {
+ ProtobufEventType::SoftKeyboardVisibilityChanged
+ },
})
}
}
@@ -2986,12 +3038,16 @@ impl TryFrom<ProtobufPaneContents> for PaneContents {
.selected_text
.map(|st| st.try_into())
.transpose()?;
+ let cursor = protobuf_contents
+ .cursor
+ .map(|p| (p.column as usize, p.line as usize));
Ok(PaneContents {
viewport: protobuf_contents.viewport,
selected_text,
lines_above_viewport: protobuf_contents.lines_above_viewport,
lines_below_viewport: protobuf_contents.lines_below_viewport,
+ cursor,
})
}
}
@@ -3003,12 +3059,17 @@ impl TryFrom<PaneContents> for ProtobufPaneContents {
.selected_text
.map(|st| st.try_into())
.transpose()?;
+ let cursor = pane_contents.cursor.map(|(x, y)| ProtobufPosition {
+ line: y as i64,
+ column: x as i64,
+ });
Ok(ProtobufPaneContents {
viewport: pane_contents.viewport,
selected_text,
lines_above_viewport: pane_contents.lines_above_viewport,
lines_below_viewport: pane_contents.lines_below_viewport,
+ cursor,
})
}
}
@@ -3104,6 +3165,7 @@ fn serialize_pane_render_report_with_ansi_event_with_data() {
selected_text: None,
lines_above_viewport: vec![],
lines_below_viewport: vec![],
+ cursor: None,
},
);
let event = Event::PaneRenderReportWithAnsi(pane_contents_map);