readme on install for debian
parent
41962fd914
commit
cc7329f6e4
Binary file not shown.
12
src/gui.rs
12
src/gui.rs
|
|
@ -11,7 +11,7 @@ pub fn main() -> iced::Result {
|
||||||
|
|
||||||
struct Main {
|
struct Main {
|
||||||
ntfy: String,
|
ntfy: String,
|
||||||
configuring: bool,
|
configuring: Option<&char>,
|
||||||
inputs: Inputs,
|
inputs: Inputs,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ impl Application for Main {
|
||||||
fn new(_flags: ()) -> (Self, Command<Message>) {
|
fn new(_flags: ()) -> (Self, Command<Message>) {
|
||||||
return (Self {
|
return (Self {
|
||||||
ntfy: String::from(":wave:"),
|
ntfy: String::from(":wave:"),
|
||||||
configuring: false,
|
configuring: None,
|
||||||
inputs: Inputs{
|
inputs: Inputs{
|
||||||
stick: Stick {
|
stick: Stick {
|
||||||
up: 'w',
|
up: 'w',
|
||||||
|
|
@ -84,7 +84,7 @@ impl Application for Main {
|
||||||
|
|
||||||
fn update(&mut self, msg: Message) -> Command<Message> {
|
fn update(&mut self, msg: Message) -> Command<Message> {
|
||||||
match msg {
|
match msg {
|
||||||
Message::EventOccurred(event) if self.configuring => {
|
Message::EventOccurred(event) if self.configuring.is_some() => {
|
||||||
match event {
|
match event {
|
||||||
iced::event::Event::Keyboard(keyboard::Event::KeyPressed{
|
iced::event::Event::Keyboard(keyboard::Event::KeyPressed{
|
||||||
key_code,
|
key_code,
|
||||||
|
|
@ -92,14 +92,16 @@ impl Application for Main {
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
self.ntfy = format!("would set {:?}", key_code);
|
self.ntfy = format!("would set {:?}", key_code);
|
||||||
self.configuring = false;
|
self.configuring = None;
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Message::EventOccurred(event) if ! self.configuring => {},
|
Message::EventOccurred(event) if ! self.configuring => {},
|
||||||
_ => {
|
_ => {
|
||||||
self.configuring = true;
|
self.configuring = Some(match event {
|
||||||
|
_ => None,
|
||||||
|
});
|
||||||
self.ntfy = format!("push a key to bind to {:?}", msg);
|
self.ntfy = format!("push a key to bind to {:?}", msg);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue