Function bodies 84 total
description function · rust · L42-L83 (42 LOC)src/action_types.rs
pub(crate) fn description(&self) -> String {
match self {
ActionType::MoveFocus => "Move focus".to_string(),
ActionType::MovePaneWithDirection => "Move pane".to_string(),
ActionType::ResizeIncrease => "Increase size".to_string(),
ActionType::ResizeDecrease => "Decrease size".to_string(),
ActionType::ResizeAny => "Resize".to_string(),
ActionType::Search => "Search".to_string(),
ActionType::NewPaneDown => "Horizontal split".to_string(),
ActionType::NewPaneRight => "Vertical split".to_string(),
ActionType::NewPaneWithoutDirection => "New pane".to_string(),
ActionType::GoToAdjacentTab => "Move tab focus".to_string(),
ActionType::Scroll => "Scroll".to_string(),
ActionType::PageScroll => "Page scroll".to_string(),
ActionType::HalfPageScroll => "Half page scroll".to_string(),
ActionType::SessionManager => "Session mis_mode_switch function · rust · L86-L88 (3 LOC)src/action_types.rs
pub(crate) fn is_mode_switch(&self) -> bool {
matches!(self, ActionType::SwitchToMode(_))
}icon function · rust · L92-L132 (41 LOC)src/action_types.rs
pub(crate) fn icon(&self) -> &str {
match self {
ActionType::SwitchToMode(m) => match m {
InputMode::Normal => "",
InputMode::Locked => "",
InputMode::Pane => "",
InputMode::Tab => "",
InputMode::Resize => "",
InputMode::Move => "",
InputMode::Scroll => "",
InputMode::Session => "",
InputMode::Search | InputMode::EnterSearch => "",
InputMode::RenameTab | InputMode::RenamePane => "",
InputMode::Tmux => "",
InputMode::Prompt => "",
},
ActionType::MoveFocus => "",
ActionType::MovePaneWithDirection => "",
ActionType::ResizeIncrease | ActionType::ResizeDecrease | ActionType::ResizeAny => "",
ActionType::NewPaneDown | ActionType::NewPaneRight | ActionType::NewPaneWithoutDirection => "",
Actionicon_color function · rust · L135-L165 (31 LOC)src/action_types.rs
pub(crate) fn icon_color<'a>(&self, colors: &'a crate::config::IconColors) -> &'a crate::config::Color {
match self {
ActionType::SwitchToMode(_) => &colors.mode_switch,
ActionType::MoveFocus | ActionType::MovePaneWithDirection => &colors.navigation,
ActionType::GoToAdjacentTab | ActionType::ToggleTab => &colors.navigation,
ActionType::ResizeIncrease | ActionType::ResizeDecrease | ActionType::ResizeAny => {
&colors.resize
}
ActionType::NewPaneDown
| ActionType::NewPaneRight
| ActionType::NewPaneWithoutDirection
| ActionType::NewStackedPane
| ActionType::NewTab => &colors.create,
ActionType::CloseFocus | ActionType::CloseTab | ActionType::Quit => &colors.close,
ActionType::Detach => &colors.close,
ActionType::ToggleFocusFullscreen
| ActionType::ToggleFloatingPanes
| ActionType::Toggfrom_action function · rust · L166-L206 (41 LOC)src/action_types.rs
pub(crate) fn from_action(action: &Action) -> Self {
match action {
Action::MoveFocus { .. } => ActionType::MoveFocus,
Action::MovePane { direction: Some(_) } => ActionType::MovePaneWithDirection,
Action::Resize { resize: Resize::Increase, direction: Some(_) } => ActionType::ResizeIncrease,
Action::Resize { resize: Resize::Decrease, direction: Some(_) } => ActionType::ResizeDecrease,
Action::Resize { direction: None, .. } => ActionType::ResizeAny,
Action::Search { .. } => ActionType::Search,
Action::NewPane { direction: Some(Direction::Down), .. } => ActionType::NewPaneDown,
Action::NewPane { direction: Some(Direction::Right), .. } => ActionType::NewPaneRight,
Action::NewPane { direction: Some(_), .. } => ActionType::NewPaneDown, // fallback
Action::NewPane { direction: None, .. } => ActionType::NewPaneWithoutDirection,
Action::NewStackedPane is_any_plugin_launch function · rust · L210-L213 (4 LOC)src/action_types.rs
pub(crate) fn is_any_plugin_launch(action: &Action) -> bool {
let s = format!("{:?}", action);
s.starts_with("LaunchOrFocusPlugin") || s.starts_with("LaunchPlugin(")
}extract_plugin_name function · rust · L217-L239 (23 LOC)src/action_types.rs
pub(crate) fn extract_plugin_name(action: &Action) -> String {
let s = format!("{:?}", action);
// Alias variant: PluginAlias { name: "zellij-loom", ...
if let Some(after) = s.split("name: \"").nth(1) {
if let Some(name) = after.split('"').next() {
return name.to_string();
}
}
// RunPlugin with Zellij location: location: Zellij(PluginTag("about"))
if let Some(after) = s.split("Zellij(PluginTag(\"").nth(1) {
if let Some(tag) = after.split('"').next() {
return format!("zellij:{}", tag);
}
}
// RunPlugin with file location: location: File("/path/to/plugin.wasm")
if let Some(after) = s.split("File(\"").nth(1) {
if let Some(path) = after.split('"').next() {
let name = path.split('/').last().unwrap_or(path);
return name.trim_end_matches(".wasm").to_string();
}
}
"Plugin".to_string()
}Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
plugin_display_name function · rust · L244-L254 (11 LOC)src/action_types.rs
fn plugin_display_name(name: &str) -> String {
if let Some(tag) = name.strip_prefix("zellij:") {
let mut chars = tag.chars();
match chars.next() {
None => tag.to_string(),
Some(f) => f.to_uppercase().collect::<String>() + chars.as_str(),
}
} else {
name.to_string()
}
}fg function · rust · L16-L22 (7 LOC)src/config.rs
pub(crate) fn fg(&self) -> String {
match self {
Color::None => String::new(),
Color::Rgb(r, g, b) => format!("\x1b[38;2;{};{};{}m", r, g, b),
Color::EightBit(n) => format!("\x1b[38;5;{}m", n),
}
}bg function · rust · L24-L30 (7 LOC)src/config.rs
pub(crate) fn bg(&self) -> String {
match self {
Color::None => String::new(),
Color::Rgb(r, g, b) => format!("\x1b[48;2;{};{};{}m", r, g, b),
Color::EightBit(n) => format!("\x1b[48;5;{}m", n),
}
}from_hex function · rust · L32-L42 (11 LOC)src/config.rs
fn from_hex(hex: &str) -> Option<Self> {
if let Some(n) = hex.strip_prefix("8bit:") {
return Some(Color::EightBit(n.parse().ok()?));
}
let hex = hex.strip_prefix('#').unwrap_or(hex);
if hex.len() != 6 { return None; }
let r = u8::from_str_radix(&hex[0..2], 16).ok()?;
let g = u8::from_str_radix(&hex[2..4], 16).ok()?;
let b = u8::from_str_radix(&hex[4..6], 16).ok()?;
Some(Color::Rgb(r, g, b))
}new function · rust · L58-L64 (7 LOC)src/config.rs
pub(crate) fn new(fg: &str, bg: &str, attr: &str) -> Self {
Self {
fg: fg.to_string(),
bg: bg.to_string(),
attr: attr.to_string(),
}
}from_name function · rust · L111-L332 (222 LOC)src/config.rs
fn from_name(name: &str) -> Self {
match name {
// (fg, bg, attr)
//
// Powerline: per-segment bg with arrow separators.
// Separator text widgets (s_ms, s_sb, etc.) are defined as
// default text widgets in build_from_palette().
//
// Left: [mode bg=accent]▶[session bg=dim]▶[tabs]
// Right: [cwd]▸[git]◂[memory bg=dim]◂[time bg=accent]
"powerline" => Self {
format_left: "{mode}{s_ms}{session}{s_sb}{tabs}",
format_center: "",
format_right: "{cwd}{git_branch}{s_gm}{memory}{s_mt}{time}",
bar_bg: "bg",
mode_format: " {content} ",
mode_style: ("bg", "accent", "bold"),
mode_content: &[],
session_format: " {name} ",
session_style: ("accent", "surface", ""from_styling function · rust · L358-L379 (22 LOC)src/config.rs
pub(crate) fn from_styling(s: &Styling) -> Self {
let fg = s.text_unselected.base;
// Derive dim from fg. table_title.background maps to palette.gray, but
// old-style palette themes don't define gray and new-style themes may
// assign arbitrary colors. A dimmed fg is consistently readable.
let dim = dim_color(fg);
let bg = s.text_unselected.background;
Self {
fg: palette_color_to_hex(fg),
bg: palette_color_to_hex(bg),
dim: palette_color_to_hex(dim),
surface: palette_color_to_hex(lighten_color(bg, 10)),
surface_bright: palette_color_to_hex(lighten_color(bg, 20)),
red: palette_color_to_hex(s.exit_code_error.base),
green: palette_color_to_hex(s.exit_code_success.base),
yellow: palette_color_to_hex(s.exit_code_error.emphasis_0),
blue: palette_color_to_hex(s.ribbon_unselected.emphasis_2),
magenta: palette_color_tfrom_name function · rust · L382-L429 (48 LOC)src/config.rs
pub(crate) fn from_name(name: &str) -> Self {
match name {
"catppuccin-mocha" => Self {
fg: "#cdd6f4".into(),
bg: "#1e1e2e".into(),
dim: "#585b70".into(),
surface: "#313244".into(),
surface_bright: "#45475a".into(),
red: "#f38ba8".into(),
green: "#a6e3a1".into(),
yellow: "#f9e2af".into(),
blue: "#89b4fa".into(),
magenta: "#cba6f7".into(),
cyan: "#89dceb".into(),
orange: "#fab387".into(),
},
"nord" => Self {
fg: "#eceff4".into(),
bg: "#2e3440".into(),
dim: "#4c566a".into(),
surface: "#3b4252".into(),
surface_bright: "#434c5e".into(),
red: "#bf616a".into(),
green: "#a3be8c".into(),
yellow: "#ebcb8b".into(),
bluWant fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
apply_overrides function · rust · L432-L452 (21 LOC)src/config.rs
pub(crate) fn apply_overrides(&mut self, config: &BTreeMap<String, String>) {
macro_rules! override_field {
($key:expr, $field:expr) => {
if let Some(v) = config.get($key) {
$field = v.clone();
}
};
}
override_field!("palette_fg", self.fg);
override_field!("palette_bg", self.bg);
override_field!("palette_dim", self.dim);
override_field!("palette_surface", self.surface);
override_field!("palette_surface_bright", self.surface_bright);
override_field!("palette_red", self.red);
override_field!("palette_green", self.green);
override_field!("palette_yellow", self.yellow);
override_field!("palette_blue", self.blue);
override_field!("palette_magenta", self.magenta);
override_field!("palette_cyan", self.cyan);
override_field!("palette_orange", self.orange);
}resolve function · rust · L457-L473 (17 LOC)src/config.rs
pub(crate) fn resolve(&self, name: &str) -> Option<&str> {
match name {
"fg" => Some(&self.fg),
"bg" => Some(&self.bg),
"dim" => Some(&self.dim),
"surface" => Some(&self.surface),
"surface_bright" => Some(&self.surface_bright),
"red" => Some(&self.red),
"green" => Some(&self.green),
"yellow" => Some(&self.yellow),
"blue" => Some(&self.blue),
"magenta" => Some(&self.magenta),
"cyan" => Some(&self.cyan),
"orange" => Some(&self.orange),
_ => None,
}
}dim_color function · rust · L477-L483 (7 LOC)src/config.rs
fn dim_color(color: PaletteColor) -> PaletteColor {
match color {
PaletteColor::Rgb((r, g, b)) => PaletteColor::Rgb((r / 2, g / 2, b / 2)),
// EightBit(8) = "bright black" = dark gray in most terminals
PaletteColor::EightBit(_) => PaletteColor::EightBit(8),
}
}lighten_color function · rust · L486-L495 (10 LOC)src/config.rs
fn lighten_color(color: PaletteColor, amount: u8) -> PaletteColor {
match color {
PaletteColor::Rgb((r, g, b)) => PaletteColor::Rgb((
r.saturating_add(amount),
g.saturating_add(amount),
b.saturating_add(amount),
)),
PaletteColor::EightBit(_) => PaletteColor::EightBit(8),
}
}palette_color_to_hex function · rust · L499-L504 (6 LOC)src/config.rs
fn palette_color_to_hex(color: PaletteColor) -> String {
match color {
PaletteColor::Rgb((r, g, b)) => format!("#{:02x}{:02x}{:02x}", r, g, b),
PaletteColor::EightBit(n) => format!("8bit:{}", n),
}
}default function · rust · L507-L522 (16 LOC)src/config.rs
fn default() -> Self {
Self {
fg: "#c0caf5".into(),
bg: "#1a1b26".into(),
dim: "#565f89".into(),
surface: "#24283b".into(),
surface_bright: "#292e42".into(),
red: "#f7768e".into(),
green: "#9ece6a".into(),
yellow: "#e0af68".into(),
blue: "#7aa2f7".into(),
magenta: "#bb9af7".into(),
cyan: "#2ac3de".into(),
orange: "#ff9e64".into(),
}
}from_palette function · rust · L539-L552 (14 LOC)src/config.rs
fn from_palette(p: &ThemePalette) -> Self {
let c = |hex: &str| Color::from_hex(hex).unwrap_or_default();
Self {
navigation: c(&p.cyan),
create: c(&p.green),
close: c(&p.red),
resize: c(&p.orange),
toggle: c(&p.yellow),
search: c(&p.magenta),
mode_switch: c(&p.blue),
plugin: c(&p.fg),
dim: c(&p.dim),
}
}from_config function · rust · L680-L693 (14 LOC)src/config.rs
pub(crate) fn from_config(config: &BTreeMap<String, String>) -> Self {
let use_system_theme = config.get("theme").map_or(true, |t| t == "system");
// For "system" (default), use tokyonight as placeholder until ModeUpdate delivers Styling.
let mut palette = match config.get("theme") {
Some(name) if name != "system" => ThemePalette::from_name(name),
_ => ThemePalette::default(),
};
palette.apply_overrides(config);
let mut hud = Self::build_from_palette(&palette, config);
hud.use_system_theme = use_system_theme;
hud
}All rows above produced by Repobility · https://repobility.com
apply_system_theme function · rust · L696-L710 (15 LOC)src/config.rs
pub(crate) fn apply_system_theme(
&mut self,
styling: &Styling,
config: &BTreeMap<String, String>,
) {
let mut palette = ThemePalette::from_styling(styling);
palette.apply_overrides(config);
let rebuilt = Self::build_from_palette(&palette, config);
// Update resolved color fields; preserve non-color config.
self.icon_colors = rebuilt.icon_colors;
self.palette = rebuilt.palette;
// Widget styles and tooltip colors use palette names resolved
// at render time, so they don't need rebuilding on theme change.
}build_from_palette function · rust · L711-L1102 (392 LOC)src/config.rs
fn build_from_palette(palette: &ThemePalette, config: &BTreeMap<String, String>) -> Self {
let ws = |s: WStyle| WidgetStyle::new(s.0, s.1, s.2);
let style_name = config.get("style").map(|s| s.as_str()).unwrap_or("simple");
let sd = StyleDefaults::from_name(style_name);
let icon_colors = IconColors::from_palette(palette);
let mode_accent = HashMap::from([
(InputMode::Normal, "blue".to_string()),
(InputMode::Locked, "red".to_string()),
(InputMode::Resize, "yellow".to_string()),
(InputMode::Pane, "cyan".to_string()),
(InputMode::Tab, "green".to_string()),
(InputMode::Scroll, "magenta".to_string()),
(InputMode::Search, "magenta".to_string()),
(InputMode::EnterSearch, "magenta".to_string()),
(InputMode::RenameTab, "yellow".to_string()),
(InputMode::RenamePane, "yellow".to_string()),
(InputMode::Session, "cyan".to_stis_reserved_name function · rust · L1113-L1115 (3 LOC)src/config.rs
fn is_reserved_name(name: &str) -> bool {
Self::RESERVED_PREFIXES.contains(&name)
}parse_user_widgets function · rust · L1124-L1184 (61 LOC)src/config.rs
fn parse_user_widgets(
config: &BTreeMap<String, String>,
) -> (HashMap<String, CommandWidget>, HashMap<String, TextWidget>) {
let mut commands = HashMap::new();
let mut texts = HashMap::new();
for key in config.keys() {
// Try NAME_command pattern
if let Some(name) = key.strip_suffix("_command") {
if name.is_empty() || Self::is_reserved_name(name) {
continue;
}
if commands.contains_key(name) {
continue;
}
let command = config.get(key).cloned().unwrap_or_default();
let mut style = WidgetStyle::default();
Self::parse_widget_style(config, name, &mut style);
let format = config
.get(&format!("{name}_format"))
.cloned()
.unwrap_or_else(|| "{stdout}".to_string());
let interval = config
parse_widget_style function · rust · L1187-L1201 (15 LOC)src/config.rs
fn parse_widget_style(
config: &BTreeMap<String, String>,
prefix: &str,
style: &mut WidgetStyle,
) {
if let Some(v) = config.get(&format!("{}_fg", prefix)) {
style.fg = v.clone();
}
if let Some(v) = config.get(&format!("{}_bg", prefix)) {
style.bg = v.clone();
}
if let Some(v) = config.get(&format!("{}_attr", prefix)) {
style.attr = v.clone();
}
}parse_optional_style function · rust · L1205-L1221 (17 LOC)src/config.rs
fn parse_optional_style(
config: &BTreeMap<String, String>,
prefix: &str,
) -> Option<WidgetStyle> {
let fg = config.get(&format!("{}_fg", prefix));
let bg = config.get(&format!("{}_bg", prefix));
let attr = config.get(&format!("{}_attr", prefix));
if fg.is_some() || bg.is_some() || attr.is_some() {
Some(WidgetStyle {
fg: fg.cloned().unwrap_or_default(),
bg: bg.cloned().unwrap_or_default(),
attr: attr.cloned().unwrap_or_default(),
})
} else {
None
}
}resolve_color function · rust · L1224-L1227 (4 LOC)src/config.rs
fn resolve_color(value: &str, palette: &ThemePalette) -> Option<Color> {
let hex = palette.resolve(value).unwrap_or(value);
Color::from_hex(hex)
}resolve_color_with_accent function · rust · L1230-L1247 (18 LOC)src/config.rs
pub(crate) fn resolve_color_with_accent(
&self,
value: &str,
palette: &ThemePalette,
mode: InputMode,
) -> Color {
if value == "accent" {
let accent_name = self
.mode_accent
.get(&mode)
.map(|s| s.as_str())
.unwrap_or("blue");
let hex = palette.resolve(accent_name).unwrap_or(accent_name);
Color::from_hex(hex).unwrap_or_default()
} else {
Self::resolve_color(value, palette).unwrap_or_default()
}
}Repobility · MCP-ready · https://repobility.com
default function · rust · L1251-L1253 (3 LOC)src/config.rs
fn default() -> Self {
Self::from_config(&BTreeMap::new())
}all_keybinds_for_mode function · rust · L44-L55 (12 LOC)src/keybinds.rs
fn all_keybinds_for_mode(
mode_info: &ModeInfo,
mode: InputMode,
) -> Vec<(KeyWithModifier, Vec<Action>)> {
let mut result = Vec::new();
for (m, bindings) in &mode_info.keybinds {
if *m == mode {
result.extend(bindings.iter().cloned());
}
}
result
}get_actions_for_mode function · rust · L58-L81 (24 LOC)src/keybinds.rs
pub(crate) fn get_actions_for_mode(
mode_info: &ModeInfo,
mode: InputMode,
) -> ModeActions {
let predicates = mode_predicates(mode);
let mut all_actions = find_actions(mode_info, mode, &predicates);
// Append any plugin-launch keybinds not covered by explicit predicates.
all_actions.extend(collect_plugin_launches(mode_info, mode));
// Find ActionTypes common to ALL tooltip modes (e.g., Quit, SwitchToMode(Locked))
let common_types = find_common_action_types(mode_info);
// Filter out common actions from main list
let actions: Vec<KeyAction> = all_actions
.into_iter()
.filter(|a| !common_types.contains(&a.action_type))
.collect();
// Find iconifiable common keys for bottom display
let common = find_common_keys(mode_info, mode, &common_types);
ModeActions { actions, common }
}find_common_action_types function · rust · L84-L107 (24 LOC)src/keybinds.rs
fn find_common_action_types(mode_info: &ModeInfo) -> HashSet<ActionType> {
let mut sets: Vec<HashSet<ActionType>> = Vec::new();
for &m in TOOLTIP_MODES {
let keybinds = all_keybinds_for_mode(mode_info, m);
let mut mode_types = HashSet::new();
for (_key, actions) in &keybinds {
if let Some(first) = actions.first() {
mode_types.insert(ActionType::from_action(first));
}
}
sets.push(mode_types);
}
if sets.is_empty() {
return HashSet::new();
}
let mut common = sets[0].clone();
for s in &sets[1..] {
common = common.intersection(s).cloned().collect();
}
common
}find_common_keys function · rust · L111-L140 (30 LOC)src/keybinds.rs
fn find_common_keys(
mode_info: &ModeInfo,
mode: InputMode,
common_types: &HashSet<ActionType>,
) -> Vec<CommonKey> {
let keybinds = all_keybinds_for_mode(mode_info, mode);
let mut seen_icons = Vec::new();
let mut common = Vec::new();
for (key, actions) in &keybinds {
if let Some(first) = actions.first() {
let action_type = ActionType::from_action(first);
if common_types.contains(&action_type) {
let key_str = format!("{}", key);
if let Some(icon) = key_to_icon(&key_str) {
if !seen_icons.contains(&icon) {
seen_icons.push(icon);
common.push(CommonKey {
icon,
description: action_type.description(),
});
}
}
}
}
}
common
}key_to_icon function · rust · L143-L149 (7 LOC)src/keybinds.rs
fn key_to_icon(key: &str) -> Option<&'static str> {
match key {
"ESC" | "Esc" => Some(""),
"ENTER" | "Enter" => Some(""),
_ => None,
}
}format_key function · rust · L152-L160 (9 LOC)src/keybinds.rs
pub(crate) fn format_key(key: &str) -> String {
if let Some(rest) = key.strip_prefix("Ctrl ") {
format!("C-{}", rest)
} else if let Some(rest) = key.strip_prefix("Alt ") {
format!("A-{}", rest)
} else {
key.to_string()
}
}find_actions function · rust · L164-L201 (38 LOC)src/keybinds.rs
fn find_actions(
mode_info: &ModeInfo,
mode: InputMode,
predicates: &[fn(&Action) -> bool],
) -> Vec<KeyAction> {
let keybinds = all_keybinds_for_mode(mode_info, mode);
let mut result = Vec::new();
for predicate in predicates {
let mut best_key: Option<String> = None;
let mut matched_action: Option<&Action> = None;
for (key, actions) in &keybinds {
if let Some(first) = actions.first() {
if predicate(first) {
let key_str = format!("{}", key);
if best_key
.as_ref()
.map_or(true, |bk| key_str.len() < bk.len())
{
best_key = Some(key_str);
matched_action = Some(first);
}
}
}
}
if let (Some(key), Some(action)) = (best_key, matched_action) {
result.push(KeyAction {
key: fMethodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
description_for_action function · rust · L204-L238 (35 LOC)src/keybinds.rs
fn description_for_action(action: &Action) -> String {
match action {
Action::MoveFocus { direction: Direction::Left } => "Move left".into(),
Action::MoveFocus { direction: Direction::Down } => "Move down".into(),
Action::MoveFocus { direction: Direction::Up } => "Move up".into(),
Action::MoveFocus { direction: Direction::Right } => "Move right".into(),
Action::MovePane { direction: Some(Direction::Left) } => "Move pane left".into(),
Action::MovePane { direction: Some(Direction::Down) } => "Move pane down".into(),
Action::MovePane { direction: Some(Direction::Up) } => "Move pane up".into(),
Action::MovePane { direction: Some(Direction::Right) } => "Move pane right".into(),
Action::Resize { resize: Resize::Increase, direction: None } => "Increase size".into(),
Action::Resize { resize: Resize::Decrease, direction: None } => "Decrease size".into(),
Action::Resize { resize: Resize::Increase, directicollect_plugin_launches function · rust · L242-L266 (25 LOC)src/keybinds.rs
fn collect_plugin_launches(mode_info: &ModeInfo, mode: InputMode) -> Vec<KeyAction> {
let keybinds = all_keybinds_for_mode(mode_info, mode);
let mut seen: HashSet<ActionType> = HashSet::new();
let mut result = Vec::new();
for (key, actions) in &keybinds {
if let Some(first) = actions.first() {
if is_any_plugin_launch(first) {
let at = ActionType::from_action(first);
// Only include truly unknown plugins (LaunchPlugin variant);
// known ones (SessionManager, PluginManager, Configuration) are
// handled by explicit predicates and should not be duplicated.
if matches!(&at, ActionType::LaunchPlugin(_)) && !seen.contains(&at) {
seen.insert(at.clone());
result.push(KeyAction {
key: format_key(&format!("{}", key)),
action_type: at,
description: description_for_action(mode_predicates function · rust · L269-L364 (96 LOC)src/keybinds.rs
fn mode_predicates(mode: InputMode) -> Vec<fn(&Action) -> bool> {
match mode {
InputMode::Locked => vec![
|a| matches!(a, Action::SwitchToMode { input_mode: InputMode::Normal }),
],
InputMode::Normal => vec![
|a| matches!(a, Action::SwitchToMode { input_mode: InputMode::Locked }),
|a| matches!(a, Action::SwitchToMode { input_mode: InputMode::Pane }),
|a| matches!(a, Action::SwitchToMode { input_mode: InputMode::Tab }),
|a| matches!(a, Action::SwitchToMode { input_mode: InputMode::Resize }),
|a| matches!(a, Action::SwitchToMode { input_mode: InputMode::Move }),
|a| matches!(a, Action::SwitchToMode { input_mode: InputMode::Scroll }),
|a| matches!(a, Action::SwitchToMode { input_mode: InputMode::Session }),
|a| matches!(a, Action::Quit),
],
InputMode::Pane => vec![
|a| matches!(a, Action::MoveFocus { direction: Direction::Left shell_escape function · rust · L20-L29 (10 LOC)src/main.rs
fn shell_escape(s: &str) -> Cow<'_, str> {
if s.is_empty() {
return Cow::Borrowed("''");
}
if s.bytes().all(|b| matches!(b, b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9' | b'_' | b'-' | b'.' | b'/')) {
Cow::Borrowed(s)
} else {
Cow::Owned(format!("'{}'", s.replace('\'', "'\\''")))
}
}default function · rust · L105-L129 (25 LOC)src/main.rs
fn default() -> Self {
Self {
role: Role::Daemon,
mode: InputMode::Locked,
mode_info: None,
tabs: Vec::new(),
has_permission: false,
hud_is_open: false,
tooltip_is_open: false,
own_plugin_id: None,
own_client_id: 0,
spawned_for_client: 0,
active_tab_idx: 0,
initial_tab: 0,
cwd: PathBuf::new(),
session_name: String::new(),
plugin_config: BTreeMap::new(),
hud_config: HudConfig::default(),
enable_status_bar: true,
enable_tooltip: true,
render_ready: false,
command_outputs: HashMap::new(),
command_timers: HashMap::new(),
}
}resolve_base_mode function · rust · L134-L139 (6 LOC)src/main.rs
fn resolve_base_mode(&self) -> InputMode {
self.mode_info
.as_ref()
.and_then(|mi| mi.base_mode)
.unwrap_or(InputMode::Normal)
}update_cwd_from_focused_pane function · rust · L142-L150 (9 LOC)src/main.rs
fn update_cwd_from_focused_pane(&mut self) {
if let Ok((_tab_idx, pane_id)) = get_focused_pane_info() {
if let PaneId::Terminal(_) = pane_id {
if let Ok(new_cwd) = get_pane_cwd(pane_id) {
self.cwd = new_cwd;
}
}
}
}run_all_command_widgets function · rust · L153-L157 (5 LOC)src/main.rs
fn run_all_command_widgets(&self) {
for (name, widget) in &self.hud_config.command_widgets {
self.run_command_widget(name, &widget.command);
}
}Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
tick_command_widgets function · rust · L160-L177 (18 LOC)src/main.rs
fn tick_command_widgets(&mut self) {
let names_and_cmds: Vec<(String, String, u32)> = self
.hud_config
.command_widgets
.iter()
.filter(|(_, w)| w.interval > 0)
.map(|(name, w)| (name.clone(), w.command.clone(), w.interval))
.collect();
for (name, command, interval) in names_and_cmds {
let counter = self.command_timers.entry(name.clone()).or_insert(0);
*counter += 1;
if *counter >= interval {
*counter = 0;
self.run_command_widget(&name, &command);
}
}
}run_command_widget function · rust · L180-L190 (11 LOC)src/main.rs
fn run_command_widget(&self, name: &str, command: &str) {
let mut ctx = BTreeMap::new();
ctx.insert(CMD_CONTEXT_USER.to_string(), name.to_string());
let cwd = self.cwd.to_string_lossy();
let full_cmd = if cwd.is_empty() {
command.to_string()
} else {
format!("cd {} && {}", shell_escape(&cwd), command)
};
run_command(&["sh", "-c", &full_cmd], ctx);
}broadcast_mode_sync function · rust · L193-L198 (6 LOC)src/main.rs
fn broadcast_mode_sync(&self) {
pipe_message_to_plugin(
MessageToPlugin::new("mode_sync")
.with_payload(format!("{}:{:?}", self.own_client_id, self.mode)),
);
}page 1 / 2next ›