From 836f40c93c76c47978de0e227fbdd0c1521a18d8 Mon Sep 17 00:00:00 2001
From: Philipp Reiter
Date: Sun, 15 Sep 2024 14:24:53 +0200
Subject: [PATCH] Add neon theme & fix help popping up in input mode
---
wireman-theme/resources/skins/neon.toml | 82 +++++++++++++++++++++++++
wireman/src/events.rs | 10 +--
wireman/src/events/headers.rs | 17 +++--
3 files changed, 95 insertions(+), 14 deletions(-)
create mode 100644 wireman-theme/resources/skins/neon.toml
diff --git a/wireman-theme/resources/skins/neon.toml b/wireman-theme/resources/skins/neon.toml
new file mode 100644
index 0000000..7c276f8
--- /dev/null
+++ b/wireman-theme/resources/skins/neon.toml
@@ -0,0 +1,82 @@
+# black #020617
+# white #f1f5f9
+# gray: #44475a
+# neon-magenta: #ff33cc
+# neon-green: #00cc66
+# neon-orange: #ff9900
+
+[base]
+background = "#020617"
+foreground = "#f1f5f9"
+
+[border.text.unfocused]
+foreground = "#f1f5f9"
+
+[border.text.focused]
+foreground = "#f1f5f9"
+
+[navbar.title]
+foreground = "#ff33cc"
+bold = true
+
+[navbar.tabs.unfocused]
+foreground = "#f1f5f9"
+background = "#020617"
+
+[navbar.tabs.focused]
+foreground = "#020617"
+background = "#00cc66"
+
+[list.focused]
+foreground = "#020617"
+background = "#ff9900"
+
+[history.inactive.unfocused]
+foreground = "#44475a"
+background = "#020617"
+
+[history.inactive.focused]
+foreground = "#020617"
+background = "#f1f5f9"
+
+[history.active.unfocused]
+foreground = "#ff9900"
+background = "#020617"
+
+[history.active.focused]
+foreground = "#020617"
+background = "#ff9900"
+
+[headers.titles]
+foreground = "#f1f5f9"
+background = "#020617"
+bold = true
+
+[headers.tabs.focused]
+foreground = "#020617"
+background = "#ff9900"
+
+[editor.selection]
+foreground = "#020617"
+background = "#ff33cc"
+
+[editor.status_line]
+bold = true
+
+[editor.status_line.primary]
+foreground = "#020617"
+background = "#ff9900"
+
+[editor.status_line.secondary]
+background = "#020617"
+
+
+
+[footer]
+hide = true
+# [footer.tabs]
+# background = "#6272A4"
+# [footer.text]
+# foreground = "#44475A"
+
+
diff --git a/wireman/src/events.rs b/wireman/src/events.rs
index 3bd2df5..e0638fe 100644
--- a/wireman/src/events.rs
+++ b/wireman/src/events.rs
@@ -56,13 +56,13 @@ impl App {
Tab::Selection => match self.ctx.selection_tab {
SelectionTab::Services => {
ServicesSelectionEventsHandler::handle_key_event(&mut self.ctx, event);
- if event.code == HELP_KEY {
+ if event.code == HELP_KEY && !self.ctx.disable_root_events {
Self::toggle_help(&mut self.ctx, ServicesSelectionEventsHandler);
}
}
SelectionTab::Methods => {
MethodsSelectionEventsHandler::handle_key_event(&mut self.ctx, event);
- if event.code == HELP_KEY {
+ if event.code == HELP_KEY && !self.ctx.disable_root_events {
Self::toggle_help(&mut self.ctx, MethodsSelectionEventsHandler);
}
}
@@ -75,20 +75,20 @@ impl App {
},
Tab::Headers => {
HeadersEventHandler::handle_key_event(&mut self.ctx, event);
- if event.code == HELP_KEY {
+ if event.code == HELP_KEY && !self.ctx.disable_root_events {
Self::toggle_help(&mut self.ctx, HeadersEventHandler);
}
}
Tab::Messages => match self.ctx.messages_tab {
MessagesTab::Request => {
RequestEventHandler::handle_key_event(&mut self.ctx, event);
- if event.code == HELP_KEY {
+ if event.code == HELP_KEY && !self.ctx.disable_root_events {
Self::toggle_help(&mut self.ctx, RequestEventHandler);
}
}
MessagesTab::Response => {
ResponseEventHandler::handle_key_event(&mut self.ctx, event);
- if event.code == HELP_KEY {
+ if event.code == HELP_KEY && !self.ctx.disable_root_events {
Self::toggle_help(&mut self.ctx, ResponseEventHandler);
}
}
diff --git a/wireman/src/events/headers.rs b/wireman/src/events/headers.rs
index 36b374c..8edca61 100644
--- a/wireman/src/events/headers.rs
+++ b/wireman/src/events/headers.rs
@@ -227,20 +227,19 @@ impl EventHandler for HeadersEventHandler {
HeadersTab::Meta => {
if let Some(input) = ctx.headers.borrow_mut().selected_editor_mut() {
input.on_key(key_event.clone().into());
+ ctx.disable_root_events = !(input.normal_mode());
}
}
HeadersTab::Addr => {
- ctx.headers
- .borrow_mut()
- .addr
- .on_key(key_event.clone().into());
+ let input = &mut ctx.headers.borrow_mut().addr;
+ input.on_key(key_event.clone().into());
+ ctx.disable_root_events = !(input.normal_mode());
}
HeadersTab::Auth => {
- ctx.headers
- .borrow_mut()
- .auth
- .selected_editor_mut()
- .on_key(key_event.clone().into());
+ let mut headers = ctx.headers.borrow_mut();
+ let input = headers.auth.selected_editor_mut();
+ input.on_key(key_event.clone().into());
+ ctx.disable_root_events = !(input.normal_mode());
}
HeadersTab::None => (),
}