chiark / gitweb /
Looks as if this is the best way to go beep!
authorSimon Tatham <anakin@pobox.com>
Sat, 23 Dec 2023 14:29:09 +0000 (14:29 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 23 Dec 2023 14:32:33 +0000 (14:32 +0000)
src/main.rs

index 22fc65c6926e7d14d1d2d12911cd993b6ba17241..e3d95955a3f8fb4cfc7bd621fcd8c1383bdc2edc 100644 (file)
@@ -2,6 +2,7 @@
 use mastodonochrome::OurError;
 use mastodonochrome::auth::AuthConfig;
 use std::io::Read;
+use std::io::Write;
 
 use crossterm::{
     event::{self, Event, KeyCode, KeyEventKind},
@@ -95,10 +96,12 @@ fn main() -> std::io::Result<()> {
                 dbg!(&ev);
                 match ev {
                     Event::Key(key) => {
-                        if key.kind == KeyEventKind::Press
-                            && key.code == KeyCode::Char('q')
-                        {
-                            break;
+                        if key.kind == KeyEventKind::Press {
+                            if key.code == KeyCode::Char('q') {
+                                break;
+                            } else if key.code == KeyCode::Char('b') {
+                                stdout().write(b"\x07")?;
+                            }
                         }
                     },
                     _ => (),