{"id":15723644,"url":"https://github.com/harzu/iced_term","last_synced_at":"2025-07-06T22:09:03.891Z","repository":{"id":215609809,"uuid":"653624273","full_name":"Harzu/iced_term","owner":"Harzu","description":"Terminal emulator widget powered by ICED framework and alacritty terminal backend.","archived":false,"fork":false,"pushed_at":"2025-02-07T12:02:43.000Z","size":6236,"stargazers_count":112,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-03T02:56:27.786Z","etag":null,"topics":["alacritty","gui","iced","rust","terminal","ui-components","widget"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Harzu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-14T12:07:39.000Z","updated_at":"2025-06-02T14:47:46.000Z","dependencies_parsed_at":"2024-07-22T00:27:00.202Z","dependency_job_id":"210ddb52-7e8a-44cf-8083-82fe96565bc5","html_url":"https://github.com/Harzu/iced_term","commit_stats":null,"previous_names":["harzu/iced-term","harzu/iced_term"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/Harzu/iced_term","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harzu%2Ficed_term","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harzu%2Ficed_term/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harzu%2Ficed_term/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harzu%2Ficed_term/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Harzu","download_url":"https://codeload.github.com/Harzu/iced_term/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harzu%2Ficed_term/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263980178,"owners_count":23538922,"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":["alacritty","gui","iced","rust","terminal","ui-components","widget"],"created_at":"2024-10-03T22:12:38.810Z","updated_at":"2025-07-06T22:09:03.873Z","avatar_url":"https://github.com/Harzu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"docs/iced_logo.svg\" width=\"140px\" /\u003e\n\u003cimg src=\"docs/iced_term_logo.png\" width=\"140px\" /\u003e\n\n# iced_term\n\n![GitHub License](https://img.shields.io/github/license/Harzu/iced_term)\n![Crates.io Downloads (recent)](https://img.shields.io/crates/dr/iced_term)\n\nTerminal emulator widget powered by ICED framework and alacritty terminal backend.\n\n\u003ca href=\"./examples/full_screen\"\u003e\n  \u003cimg src=\"examples/full_screen/assets/screenshot.png\" width=\"275px\"\u003e\n\u003c/a\u003e\n\u003ca href=\"./examples/split_view/assets/screenshot.png\"\u003e\n  \u003cimg src=\"examples/split_view/assets/screenshot.png\" width=\"273px\"\u003e\n\u003c/a\u003e\n\n\u003c/div\u003e\n\n## Unstable widget API\n\nThe ICED framework does not have the stable API and this widget is also under development, so I can not promise the stable API and to document it at least while the ICED won't release the 1.0.0 version.\n\n## Features\n\nThe widget is currently under development and does not provide full terminal features make sure that widget is covered everything you want.\n\n- PTY content rendering\n- Multiple instance support\n- Basic keyboard input\n- Mouse interaction in different modes\n- Adding custom keyboard or mouse bindings\n- Resizing\n- Scrolling\n- Focusing\n- Selecting\n- Changing Font/Color scheme\n- Hyperlinks processing (hover/open)\n\nThis widget was tested on MacOS, Linux and Windows (but only under [WSL2](https://learn.microsoft.com/en-us/windows/wsl/about)).\n\n## Installation\n\nFrom crates.io\n\n```toml\niced_term = \"0.5.1\"\n```\n\nFrom git\n\n```toml\niced_term = { git = \"https://github.com/Harzu/iced_term\", branch = \"master\" }\n```\n## Overview\n\nInteracting with the widget is happened via:\n\n**Commands** - you can send commands to widget for changing the widget state.\n\n```rust\n#[derive(Debug, Clone)]\npub enum Command {\n    InitBackend(Sender\u003cAlacrittyEvent\u003e),\n    ChangeTheme(Box\u003cColorPalette\u003e),\n    ChangeFont(FontSettings),\n    AddBindings(Vec\u003c(Binding\u003cInputKind\u003e, BindingAction)\u003e),\n    ProcessBackendCommand(BackendCommand),\n}\n```\n\n**Events** - widget is produced some events that can be handled in application. Every event has the first `u64` argument that is **terminal instance id**.\n\n```rust\n#[derive(Debug, Clone)]\npub enum Event {\n    CommandReceived(u64, Command),\n}\n```\n\nRight now there is the only internal **CommandReceived** event that is needed for backend \u003c-\u003e view communication. You can also handle this event unwrap the command and process command additionally if you want.\n\n**Actions** - widget's method `update(\u0026mut self, cmd: Command)` returns **Action** that you can handle after widget updated.\n\n```rust\n#[derive(Debug, Clone, PartialEq)]\npub enum Action {\n    Redraw,\n    Shutdown,\n    ChangeTitle,\n    Ignore,\n}\n```\n\nFor creating workable application example with this widget you need to do a several things\n\n**Step 1.** Add widget to your `App` struct\n\n```rust\nstruct App {\n    title: String,\n    term: iced_term::Terminal,\n}\n```\n\n**Step 2.** Create instance in `App` constructor\n\n```rust\nimpl App {\n    fn new() -\u003e (Self, Task\u003cEvent\u003e) {\n        let system_shell = std::env::var(\"SHELL\")\n            .expect(\"SHELL variable is not defined\")\n            .to_string();\n        let term_id = 0;\n        let term_settings = iced_term::settings::Settings {\n            backend: iced_term::settings::BackendSettings {\n                shell: system_shell.to_string(),\n            },\n            ..Default::default()\n        };\n\n        (\n            Self {\n                title: String::from(\"Terminal app\"),\n                term: iced_term::Terminal::new(term_id, term_settings),\n            },\n            Task::none(),\n        )\n    }\n}\n```\n\n**Step 3.** Add event kind to **Events/Messages** enum that will be container of internal widget events for application's **Events/Messages**. You will have to wrap inner widget events via `.map(Event::Terminal)` where it's necessary. \n\n```rust\n#[derive(Debug, Clone)]\npub enum Event {\n    // ... other events\n    Terminal(iced_term::Event),\n}\n```\n\n**Step 4.** Add **Terminal** event kind processing to application `update` method.\n\n```rust\nimpl App {\n    // ... other methods\n    fn update(\u0026mut self, event: Event) -\u003e Task\u003cEvent\u003e {\n        match event {\n            Event::Terminal(iced_term::Event::CommandReceived(\n                _,\n                cmd,\n            )) =\u003e match self.term.update(cmd) {\n                iced_term::actions::Action::Shutdown =\u003e {\n                    window::get_latest().and_then(window::close)\n                },\n                _ =\u003e Task::none(),\n            },\n        }\n    }\n}\n```\n\n**Step 5.** Add view to your application\n\n```rust\nimpl App {\n    // ... other methods\n    fn view(\u0026self) -\u003e Element\u003cEvent, Theme, iced::Renderer\u003e {\n        container(iced_term::TerminalView::show(\u0026self.term).map(Event::Terminal))\n            .width(Length::Fill)\n            .height(Length::Fill)\n            .into()\n    }\n}\n```\n\n**Step 6.** Add event subscription for getting internal events from backend (pty).\n\n```rust\nimpl App {\n    // ... other methods\n    fn subscription(\u0026self) -\u003e Subscription\u003cEvent\u003e {\n        let term_subscription = iced_term::Subscription::new(self.term.id);\n        let term_event_stream = term_subscription.event_stream();\n        Subscription::run_with_id(self.term.id, term_event_stream)\n            .map(Event::Terminal)\n    }\n}\n```\n\n**Step 7.** Add main function\n\n```rust\nfn main() -\u003e iced::Result {\n    iced::application(App::title, App::update, App::view)\n        .antialiasing(false)\n        .window_size(Size {\n            width: 1280.0,\n            height: 720.0,\n        })\n        .subscription(App::subscription)\n        .run_with(App::new)\n}\n```\n\n**Step 8.** Run your application\n\n```shell\ncargo run --release\n```\n\n**Step 9.** To be happy!\n\n## Examples\n\nYou can also look at [examples](./examples) directory for more information about widget using.\n\n- [full_screen](./examples/full_screen/) - The basic example of terminal emulator.\n- [split_view](./examples/split_view/) - The example based on split_view iced widget that show how multiple instance feature work.\n- [custom_bindings](./examples/custom_bindings/) - The example that show how you can add custom keyboard or mouse bindings to your terminal emulator app.\n- [themes](./examples/themes/) - The example that show how you can change terminal color scheme.\n- [fonts](./examples/fonts/) - The examples that show how you can change font type or font size in your terminal emulator app.\n\nYou can run any example via\n\n```shell\ncargo run --package \u003cexample name\u003e\n```\n\n## Dependencies\n\n - [iced (0.13.1)](https://github.com/iced-rs/iced/tree/master)\n - [alacritty_terminal (0.24.1)](https://github.com/alacritty/alacritty/tree/master/alacritty_terminal)\n - [tokio (1.41.1)](https://github.com/tokio-rs/tokio)\n\n## Contributing / Feedback\n\nAll feedbacks, issues and pull requests are welcomed! Guidelines is coming soon =)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharzu%2Ficed_term","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharzu%2Ficed_term","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharzu%2Ficed_term/lists"}