changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / rust/lib/obj/src/config/user.rs

changeset 698: 96958d3eb5b0
parent: c7165d93a9eb
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 //! cfg::config::user
2 //!
3 //! User configuration primitives
4 use crate::object::{direction::RelativeDirection, location::Point};
5 use serde::{Deserialize, Serialize};
6 use std::collections::HashMap;
7 
8 use crate::{AuthConfig, DisplayConfig, PackageConfig, ProjectConfig};
9 
10 /// User configuration type
11 ///
12 /// Used to configure system users for various platforms.
13 #[derive(Serialize, Deserialize, Debug, Default)]
14 pub struct UserConfig {
15  pub shell: ShellConfig,
16  pub geo: Option<Point>,
17  pub displays: Option<Vec<DisplayConfig>>,
18  pub packages: Vec<PackageConfig>,
19  pub projects: Vec<ProjectConfig>,
20  pub auth: Vec<AuthConfig>,
21 }
22 
23 #[derive(Serialize, Deserialize, Debug, Default)]
24 pub struct ShellConfig {
25  pub env: HashMap<String, String>,
26  pub cmds: HashMap<String, String>,
27  pub shell: ShellType,
28 }
29 
30 #[derive(Serialize, Deserialize, Debug, Hash, Default)]
31 pub enum ShellType {
32  #[default]
33  Bash,
34  Zsh,
35  Sh,
36 }
37 
38 /// A session is a single collection of `pseudo terminals` under the
39 /// management of tmux. Each session has one or more windows linked to
40 /// it.
41 #[derive(Serialize, Deserialize, Debug, Default)]
42 pub struct TmuxSessionConfig {
43  pub name: String,
44  pub windows: Vec<TmuxWindowConfig>,
45 }
46 
47 /// A window occupies the entire screen and may be split into
48 /// rectangular panes.
49 #[derive(Serialize, Deserialize, Debug, Default)]
50 pub struct TmuxWindowConfig {
51  pub name: String,
52  pub panes: Vec<TmuxPaneConfig>,
53 }
54 
55 /// An isolated pseudo terminal (pty) inside a Window, inside a
56 /// Session.
57 #[derive(Serialize, Deserialize, Debug, Default)]
58 pub struct TmuxPaneConfig {
59  pub name: String,
60  pub position: Option<RelativeDirection>,
61  pub init: Option<String>,
62 }