1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-09-16 03:36:58 +02:00

feat: load bars on monitor when it connects

Finally, Ironbar will respond to events of monitors being (dis)connected, and will create bars when a monitor connects.

This means at last - resolves #291

yaay
This commit is contained in:
Jake Stanger 2024-01-11 23:22:18 +00:00
commit 8371a92204
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
6 changed files with 139 additions and 96 deletions

View file

@ -1,4 +1,4 @@
use super::{Client, Environment, Event, Request, Response};
use super::{Client, Environment, Event};
use crate::try_send;
use smithay_client_toolkit::output::{OutputHandler, OutputInfo, OutputState};
use tokio::sync::broadcast;
@ -8,8 +8,8 @@ use wayland_client::{Connection, QueueHandle};
#[derive(Debug, Clone)]
pub struct OutputEvent {
output: OutputInfo,
event_type: OutputEventType,
pub output: OutputInfo,
pub event_type: OutputEventType,
}
#[derive(Debug, Clone, Copy)]
@ -21,7 +21,9 @@ pub enum OutputEventType {
impl Client {
/// Gets the information for all outputs.
#[cfg(feature = "ipc")]
pub fn output_info_all(&self) -> Vec<OutputInfo> {
use super::{Request, Response};
match self.send_request(Request::OutputInfoAll) {
Response::OutputInfoAll(info) => info,
_ => unreachable!(),
@ -35,6 +37,7 @@ impl Client {
}
impl Environment {
#[cfg(feature = "ipc")]
pub fn output_info_all(&mut self) -> Vec<OutputInfo> {
self.output_state
.outputs()