mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Extract is_laptop_panel() to utils
This commit is contained in:
@@ -8,6 +8,7 @@ use zbus::{dbus_interface, fdo, SignalContext};
|
||||
|
||||
use super::Start;
|
||||
use crate::backend::IpcOutputMap;
|
||||
use crate::utils::is_laptop_panel;
|
||||
|
||||
pub struct DisplayConfig {
|
||||
ipc_outputs: Arc<Mutex<IpcOutputMap>>,
|
||||
@@ -63,7 +64,7 @@ impl DisplayConfig {
|
||||
.map(|output| {
|
||||
// Loosely matches the check in Mutter.
|
||||
let c = &output.name;
|
||||
let is_laptop_panel = matches!(c.get(..4), Some("eDP-" | "LVDS" | "DSI-"));
|
||||
let is_laptop_panel = is_laptop_panel(c);
|
||||
let display_name = make_display_name(output, is_laptop_panel);
|
||||
|
||||
let mut properties = HashMap::new();
|
||||
|
||||
@@ -224,6 +224,10 @@ pub fn output_matches_name(output: &Output, target: &str) -> bool {
|
||||
name.matches(target)
|
||||
}
|
||||
|
||||
pub fn is_laptop_panel(connector: &str) -> bool {
|
||||
matches!(connector.get(..4), Some("eDP-" | "LVDS" | "DSI-"))
|
||||
}
|
||||
|
||||
pub fn with_toplevel_role<T>(
|
||||
toplevel: &ToplevelSurface,
|
||||
f: impl FnOnce(&mut XdgToplevelSurfaceRoleAttributes) -> T,
|
||||
|
||||
Reference in New Issue
Block a user