diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-09-03 12:13:04 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-09-03 13:48:08 +0300 |
| commit | f0157e03e72714264e684295fac226e2046f0b38 (patch) | |
| tree | 7bfd198f59697704c5464c8498d3f8d7ff80131d /src/protocols | |
| parent | 4b7c16b04a7c80f5f9b6fcbc4a1d8c9448dffbdb (diff) | |
| download | niri-f0157e03e72714264e684295fac226e2046f0b38.tar.gz niri-f0157e03e72714264e684295fac226e2046f0b38.tar.bz2 niri-f0157e03e72714264e684295fac226e2046f0b38.zip | |
Use libdisplay-info for make/model/serial parsing, implement throughout
Diffstat (limited to 'src/protocols')
| -rw-r--r-- | src/protocols/output_management.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/protocols/output_management.rs b/src/protocols/output_management.rs index 3839bdb4..4f1ac8c0 100644 --- a/src/protocols/output_management.rs +++ b/src/protocols/output_management.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use std::iter::zip; use std::mem; -use niri_config::{FloatOrInt, Vrr}; +use niri_config::{FloatOrInt, OutputName, Vrr}; use niri_ipc::Transform; use smithay::reexports::wayland_protocols_wlr::output_management::v1::server::{ zwlr_output_configuration_head_v1, zwlr_output_configuration_v1, zwlr_output_head_v1, @@ -403,12 +403,13 @@ where return; } Entry::Vacant(entry) => { + let name = OutputName::from_ipc_output(current_config); let mut config = g_state .current_config - .find(¤t_config.name) + .find(&name) .cloned() .unwrap_or_else(|| niri_config::Output { - name: current_config.name.clone(), + name: name.format_make_model_serial_or_connector(), ..Default::default() }); config.off = false; @@ -452,12 +453,13 @@ where ); } Entry::Vacant(entry) => { + let name = OutputName::from_ipc_output(current_config); let mut config = g_state .current_config - .find(¤t_config.name) + .find(&name) .cloned() .unwrap_or_else(|| niri_config::Output { - name: current_config.name.clone(), + name: name.format_make_model_serial_or_connector(), ..Default::default() }); config.off = true; @@ -841,6 +843,7 @@ fn send_new_head<D>( .unwrap(); client_data.manager.head(&new_head); new_head.name(conf.name.clone()); + // Format matches what Output::new() does internally. new_head.description(format!("{} - {} - {}", conf.make, conf.model, conf.name)); if let Some((width, height)) = conf.physical_size { if let (Ok(a), Ok(b)) = (width.try_into(), height.try_into()) { @@ -877,6 +880,11 @@ fn send_new_head<D>( if new_head.version() >= zwlr_output_head_v1::EVT_MODEL_SINCE { new_head.model(conf.model.clone()); } + if new_head.version() >= zwlr_output_head_v1::EVT_SERIAL_NUMBER_SINCE { + if let Some(serial) = &conf.serial { + new_head.serial_number(serial.clone()); + } + } if new_head.version() >= zwlr_output_head_v1::EVT_ADAPTIVE_SYNC_SINCE { new_head.adaptive_sync(match conf.vrr_enabled { |
