Skip to content

Commit e400064

Browse files
authored
feat: hide the console (#9)
Type `_exit_` to end the clafrica.
1 parent 181025f commit e400064

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/lib.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Wish {
2525
r#"
2626
wm overrideredirect {wish_obj} 1;
2727
wm attributes {wish_obj} -topmost 1;
28-
bind {wish_obj} <Button-1> {{destroy .; exit;}};
28+
bind {wish_obj} <Motion> {{destroy .; exit;}};
2929
"#
3030
));
3131
}
@@ -76,12 +76,16 @@ impl api::Frontend for Wish {
7676
}
7777

7878
fn update_text(&mut self, text: Vec<char>) {
79-
self.label.text(
80-
&text
81-
.into_iter()
82-
.map(|c| c.to_string())
83-
.collect::<Vec<_>>()
84-
.join(""),
85-
);
79+
let text = text
80+
.into_iter()
81+
.map(|c| c.to_string())
82+
.collect::<Vec<_>>()
83+
.join("");
84+
85+
self.label.text(&text);
86+
87+
if text == "_exit_" {
88+
rstk::end_wish();
89+
}
8690
}
8791
}

src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![windows_subsystem = "windows"]
2+
13
use clafrica::{run, Config};
24
use clafrica_wish::Wish;
35
use std::{env, process};

0 commit comments

Comments
 (0)