diff options
author | Aram Drevekenin <aram@poor.dev> | 2021-12-20 17:31:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-20 17:31:07 +0100 |
commit | ca8438b0aa0e5e9aa1c69f0217c275d20f269a8f (patch) | |
tree | 97ee4922eb41415d54d3cb183ad9dbef66bd7186 /zellij-tile/src | |
parent | 2c1d3a9817e70ea3d4b55672166f3417d296cc44 (diff) |
feat(collaboration): implement multiple users (#957)
* work
* feat(collaboration): implement multiple users
* style(cleanup): some leftovers
Diffstat (limited to 'zellij-tile/src')
-rw-r--r-- | zellij-tile/src/data.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/zellij-tile/src/data.rs b/zellij-tile/src/data.rs index 3e269af3b..36b44e25e 100644 --- a/zellij-tile/src/data.rs +++ b/zellij-tile/src/data.rs @@ -3,6 +3,32 @@ use std::fmt; use std::str::FromStr; use strum_macros::{EnumDiscriminants, EnumIter, EnumString, ToString}; +pub type ClientId = u16; // TODO: merge with crate type? + +pub fn client_id_to_colors( + client_id: ClientId, + colors: Palette, +) -> Option<(PaletteColor, PaletteColor)> { + // (primary color, secondary color) + match client_id { + 1 => Some((colors.magenta, colors.black)), + 2 => Some((colors.blue, colors.black)), + 3 => Some((colors.purple, colors.black)), + 4 => Some((colors.yellow, colors.black)), + 5 => Some((colors.cyan, colors.black)), + 6 => Some((colors.gold, colors.black)), + 7 => Some((colors.red, colors.black)), + 8 => Some((colors.silver, colors.black)), + 9 => Some((colors.pink, colors.black)), + 10 => Some((colors.brown, colors.black)), + _ => None, + } +} + +pub fn single_client_color(colors: Palette) -> (PaletteColor, PaletteColor) { + (colors.green, colors.black) +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum Key { Backspace, @@ -169,6 +195,11 @@ pub struct Palette { pub white: PaletteColor, pub orange: PaletteColor, pub gray: PaletteColor, + pub purple: PaletteColor, + pub gold: PaletteColor, + pub silver: PaletteColor, + pub pink: PaletteColor, + pub brown: PaletteColor, } /// Represents the contents of the help message that is printed in the status bar, @@ -193,6 +224,7 @@ pub struct TabInfo { pub panes_to_hide: usize, pub is_fullscreen_active: bool, pub is_sync_panes_active: bool, + pub other_focused_clients: Vec<ClientId>, } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)] |