feat: add configuration management and panel rendering

- Introduced a new `Config` struct for loading application configuration from a TOML file.
- Added support for keybindings and panel configurations, including status widgets.
- Implemented `PtyTerminal` for handling pseudo-terminal interactions.
- Created a rendering module to manage the display of application windows, panels, and dropdowns.
- Refactored the main application loop to utilize the new configuration and rendering logic.
- Removed legacy code related to event handling and rendering from `main.rs`.
This commit is contained in:
Björn Blomberg
2026-03-27 17:01:06 +01:00
parent d7c70baf35
commit 4440ad79bd
15 changed files with 2154 additions and 177 deletions

40
.vscode/tasks.json vendored
View File

@@ -4,54 +4,50 @@
{
"label": "Build (native)",
"type": "shell",
"command": "cargo build --release",
"group": "build",
"linux": {
"command": "cargo build --release && mkdir -p builds/linux/panels && cp target/release/tui-wm builds/linux/tui-wm && cp dist/linux/config.toml builds/linux/config.toml && cp dist/linux/panels/topbar.toml builds/linux/panels/topbar.toml && echo 'Done: builds/linux/tui-wm'"
},
"windows": {
"command": "& \"$env:USERPROFILE\\.cargo\\bin\\cargo.exe\" build --release; if ($LASTEXITCODE -eq 0) { New-Item -Force -ItemType Directory builds\\win\\panels | Out-Null; Copy-Item target\\release\\tui-wm.exe builds\\win\\tui-wm.exe -Force; Copy-Item dist\\win\\config.toml builds\\win\\config.toml -Force; Copy-Item dist\\win\\panels\\topbar.toml builds\\win\\panels\\topbar.toml -Force; Write-Host 'Done: builds\\win\\tui-wm.exe' }",
"options": { "shell": { "executable": "powershell.exe", "args": ["-NoProfile", "-Command"] } }
},
"group": { "kind": "build", "isDefault": true },
"presentation": { "reveal": "always", "panel": "shared" },
"problemMatcher": ["$rustc"]
},
{
"label": "Build Linux",
"type": "shell",
"command": "cargo build --release --target x86_64-unknown-linux-gnu",
"group": "build",
"command": "cargo build --release --target x86_64-unknown-linux-gnu && mkdir -p builds/linux/panels && cp target/x86_64-unknown-linux-gnu/release/tui-wm builds/linux/tui-wm && cp dist/linux/config.toml builds/linux/config.toml && cp dist/linux/panels/topbar.toml builds/linux/panels/topbar.toml && echo 'Done: builds/linux/tui-wm'",
"options": { "shell": { "executable": "bash", "args": ["-c"] } },
"group": "build",
"presentation": { "reveal": "always", "panel": "shared" },
"problemMatcher": ["$rustc"]
},
{
"label": "Build Windows (cross från Linux, GNU)",
"label": "Build Windows cross (GNU, från Linux)",
"type": "shell",
"command": "cargo build --release --target x86_64-pc-windows-gnu",
"group": "build",
"command": "cargo build --release --target x86_64-pc-windows-gnu && mkdir -p builds/win/panels && cp target/x86_64-pc-windows-gnu/release/tui-wm.exe builds/win/tui-wm.exe && cp dist/win/config.toml builds/win/config.toml && cp dist/win/panels/topbar.toml builds/win/panels/topbar.toml && echo 'Done: builds/win/tui-wm.exe'",
"options": { "shell": { "executable": "bash", "args": ["-c"] } },
"group": "build",
"presentation": { "reveal": "always", "panel": "shared" },
"problemMatcher": ["$rustc"]
},
{
"label": "Build Windows (MSVC — kräver VS Build Tools)",
"type": "shell",
"command": "& \"$env:USERPROFILE\\.cargo\\bin\\cargo.exe\" build --release --target x86_64-pc-windows-msvc",
"command": "& \"$env:USERPROFILE\\.cargo\\bin\\cargo.exe\" build --release --target x86_64-pc-windows-msvc; if ($LASTEXITCODE -eq 0) { New-Item -Force -ItemType Directory builds\\win\\panels | Out-Null; Copy-Item target\\x86_64-pc-windows-msvc\\release\\tui-wm.exe builds\\win\\tui-wm.exe -Force; Copy-Item dist\\win\\config.toml builds\\win\\config.toml -Force; Copy-Item dist\\win\\panels\\topbar.toml builds\\win\\panels\\topbar.toml -Force; Write-Host 'Done: builds\\win\\tui-wm.exe' }",
"options": { "shell": { "executable": "powershell.exe", "args": ["-NoProfile", "-Command"] } },
"group": "build",
"options": {
"shell": {
"executable": "powershell.exe",
"args": ["-NoProfile", "-Command"]
}
},
"presentation": { "reveal": "always", "panel": "shared" },
"problemMatcher": ["$rustc"]
},
{
"label": "Build Windows (GNU — kräver msys2 + mingw-w64)",
"type": "shell",
"command": "& \"$env:USERPROFILE\\.cargo\\bin\\cargo.exe\" build --release --target x86_64-pc-windows-gnu",
"command": "& \"$env:USERPROFILE\\.cargo\\bin\\cargo.exe\" build --release --target x86_64-pc-windows-gnu; if ($LASTEXITCODE -eq 0) { New-Item -Force -ItemType Directory builds\\win\\panels | Out-Null; Copy-Item target\\x86_64-pc-windows-gnu\\release\\tui-wm.exe builds\\win\\tui-wm.exe -Force; Copy-Item dist\\win\\config.toml builds\\win\\config.toml -Force; Copy-Item dist\\win\\panels\\topbar.toml builds\\win\\panels\\topbar.toml -Force; Write-Host 'Done: builds\\win\\tui-wm.exe' }",
"options": { "shell": { "executable": "powershell.exe", "args": ["-NoProfile", "-Command"] } },
"group": "build",
"options": {
"shell": {
"executable": "powershell.exe",
"args": ["-NoProfile", "-Command"]
}
},
"presentation": { "reveal": "always", "panel": "shared" },
"problemMatcher": ["$rustc"]
},
@@ -59,7 +55,7 @@
"label": "Run",
"type": "shell",
"command": "cargo run",
"group": { "kind": "build", "isDefault": true },
"group": "build",
"presentation": { "reveal": "always", "panel": "shared" },
"problemMatcher": ["$rustc"]
}