diff options
| author | MaxVerevkin <maxxverrr@gmail.com> | 2024-09-06 14:01:32 +0300 |
|---|---|---|
| committer | MaxVerevkin <maxxverrr@gmail.com> | 2024-09-06 14:01:32 +0300 |
| commit | 7d665ea632fd0676b217bcba367ba5728ae1b514 (patch) | |
| tree | 897fe68ba3df1fbc79ae7c03dcc52bf598f78185 /src/main.rs | |
| parent | d44a07d437eb799e742a0b3446e1329d88d61a23 (diff) | |
| download | i3bar-mango-7d665ea632fd0676b217bcba367ba5728ae1b514.tar.gz | |
flush wayland socket after tag updates on hypland
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index eed74ac..18d604e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,6 +48,11 @@ fn main() -> anyhow::Result<()> { let mut state = State::new(&mut conn, &globals, &mut el, args.config.as_deref()); conn.flush(IoMode::Blocking)?; + el.add_on_idle(|ctx| { + ctx.conn.flush(IoMode::Blocking)?; + Ok(event_loop::Action::Keep) + }); + el.register_with_fd(sig_read, move |ctx| { let mut buf = [0u8]; assert_eq!( @@ -55,16 +60,12 @@ fn main() -> anyhow::Result<()> { 1 ); ctx.state.toggle_visibility(ctx.conn); - ctx.conn.flush(IoMode::Blocking)?; Ok(event_loop::Action::Keep) }); el.register_with_fd(conn.as_raw_fd(), |ctx| { match ctx.conn.recv_events(IoMode::NonBlocking) { - Ok(()) => { - ctx.conn.dispatch_events(ctx.state); - ctx.conn.flush(IoMode::Blocking)?; - } + Ok(()) => ctx.conn.dispatch_events(ctx.state), Err(e) if e.kind() == ErrorKind::WouldBlock => (), Err(e) => bail!(e), } @@ -84,7 +85,6 @@ fn main() -> anyhow::Result<()> { Ok(None) => Ok(event_loop::Action::Keep), Ok(Some(blocks)) => { ctx.state.set_blocks(ctx.conn, blocks); - ctx.conn.flush(IoMode::Blocking)?; Ok(event_loop::Action::Keep) } Err(e) => { @@ -97,7 +97,6 @@ fn main() -> anyhow::Result<()> { .child .kill(); ctx.state.set_error(ctx.conn, e); - ctx.conn.flush(IoMode::Blocking)?; Ok(event_loop::Action::Unregister) } } |
