{"id":15294082,"url":"https://github.com/chrisduerr/bar-config","last_synced_at":"2025-10-07T06:31:15.139Z","repository":{"id":62438516,"uuid":"146144202","full_name":"chrisduerr/bar-config","owner":"chrisduerr","description":"Configuration parser for a system bar/panel/dock","archived":true,"fork":false,"pushed_at":"2018-09-10T03:24:26.000Z","size":115,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-02T07:19:49.433Z","etag":null,"topics":["bar","dock","linux","panel"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisduerr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-26T02:10:29.000Z","updated_at":"2023-01-28T00:11:39.000Z","dependencies_parsed_at":"2022-11-01T21:16:22.220Z","dependency_job_id":null,"html_url":"https://github.com/chrisduerr/bar-config","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisduerr%2Fbar-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisduerr%2Fbar-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisduerr%2Fbar-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisduerr%2Fbar-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisduerr","download_url":"https://codeload.github.com/chrisduerr/bar-config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235599860,"owners_count":19016191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bar","dock","linux","panel"],"created_at":"2024-09-30T16:57:23.704Z","updated_at":"2025-10-07T06:31:09.827Z","avatar_url":"https://github.com/chrisduerr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bar Config\n\nCrate for easily creating system bars/panels/docks.\n\nThe goal of this crate is to make it as simple as possible to create complex bars/panels/docks\nfor linux without having to worry about anything but rendering.\n\nTo get started with the crate, a new bar needs to be created. This is done using the `load`\nmethod in the `Bar`.\n\n# Examples\n\nThis example shows you how to create a simple bar with three components which prints the state\nof every component in the console every time it's updated.\n\n```rust\nuse std::io::Cursor;\n\nuse bar_config::Bar;\n\nfn main() {\n    // Create input configuration input with three components\n    let input = Cursor::new(String::from(\n        \"\\\n         height: 30\\n\\\n         monitors:\\n\\\n         - { name: \\\"DVI-1\\\" }\\n\\\n         left:\\n\\\n         - { text: \\\"Hello, World!\\\" }\\n\\\n         center:\\n\\\n         - { name: \\\"clock\\\" }\\n\\\n         right:\\n\\\n         - { text: \\\"VOLUME\\\" }\",\n    ));\n\n    // Load the bar configuration from the input\n    let mut bar = Bar::load(input).unwrap();\n\n    // Render the state of the bar at startup\n    print_bar(\u0026bar);\n\n    loop {\n        // Wait for any update to the bar\n        let _ = bar.recv();\n\n        // Print all components every time one changes\n        print_bar(\u0026bar);\n    }\n}\n\n// Prints the text of every component in the configuration\nfn print_bar(bar: \u0026Bar) {\n    for comp in bar.components() {\n        if let Some(text) = comp.text() {\n            print!(\"{}\\t\", text);\n        }\n    }\n    println!(\"\");\n}\n```\n\n## Bar Configuration Grammar\n\nThis is the grammar for the user configuration. It is designed to map to data formats\nlike YAML or JSON but should also allow an easy representation in Rust.\n\n```bash\n# Legend\n#     !   Field is required\n#     ?   Field is optional\n\n# Root element of the bar\nBar\n    # General configuration options\n    !height: u8\n    ?position: Position\n    ?background: Background\n    ?border: Border\n    !monitors: [Monitor]\n\n    # Default fallback values for components\n    ?defaults: ComponentSettings\n\n    # Component containers\n    ?left: [Component]\n    ?center: [Component]\n    ?right: [Component]\n\n# A single component/block/module in the bar\nComponent\n    # Name used to identify which component should be loaded\n    ?name: String\n\n    # State of a component (inlined struct).\n    ?ComponentSettings\n\n    # Extra options are passed to the component\n    ?_: T\n\n# Default options available for every component\n\n# Full component state which contains everything necessary for rendering a component.\nComponentSettings\n    ?foreground: (r: u8, g: u8, b: u8, a: u8)\n    ?background: Background\n    ?width: u8\n    ?padding: u8\n    ?offset_x: i8\n    ?offset_y: i8\n    ?fonts: [Font]\n\n# Background of a component or the bar\nBackground\n    !Image(path: String) | Color(r: u8, g: u8, b: u8, a: u8)\n\n# Dinstinct identification for a font\nFont\n    !name: String\n    !size: u8\n\n# Distinct identification for a monitor\nMonitor\n    !name: String\n    ?fallback_names: [String]\n\n# Border separating the bar from the rest of the WM\nBorder\n    !height: u8\n    !color: (r: u8, g: u8, b: u8, a: u8)\n\n# Available positions for the bar\nPosition\n    !Top | Bottom\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisduerr%2Fbar-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisduerr%2Fbar-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisduerr%2Fbar-config/lists"}