Allow title text to be set per app

This commit is contained in:
2Shirt 2025-01-19 17:31:46 -08:00
parent 6b2eb8155f
commit 51610fdc23
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
4 changed files with 9 additions and 8 deletions

View file

@ -1,5 +1,5 @@
{
"app_title": "Deja-vu: Clone Tool",
"app_title": "Deja-vu",
"clone_app_path": "C:/Program Files/Some Clone Tool/app.exe",
"keybindings": {
"ScanDisks": {

View file

@ -27,11 +27,15 @@ use crate::{action::Action, config::Config};
pub struct Title {
command_tx: Option<UnboundedSender<Action>>,
config: Config,
text: String,
}
impl Title {
pub fn new() -> Self {
Self::default()
pub fn new(text: &str) -> Self {
Self {
text: String::from(text),
..Default::default()
}
}
}
@ -56,7 +60,7 @@ impl Component for Title {
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
// Title Block
let title_text = Span::styled(
self.config.app_title.as_str(),
format!("{}: {}", self.config.app_title.as_str(), self.text),
Style::default().fg(Color::LightCyan),
);
let title = Paragraph::new(Line::from(title_text).centered())

View file

@ -20,8 +20,6 @@ edition = "2021"
license = "GPL"
version = "0.2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
core = { path = "../core" }
color-eyre = "0.6.3"

View file

@ -12,7 +12,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Deja-vu. If not, see <https://www.gnu.org/licenses/>.
//
use core::{
action::Action,
@ -77,7 +76,7 @@ impl App {
action_rx,
action_tx,
components: vec![
Box::new(Title::new()),
Box::new(Title::new("Clone Tool")),
Box::new(FpsCounter::new()),
Box::new(Left::new()),
Box::new(Right::new()),