From a9ea518457eaa71cbbe08685386c43f46d757f44 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 19 Mar 2026 20:35:57 +0545 Subject: [PATCH] feat(src/commands): add get_active_display_info and status display output Add function to retrieve and display active monitor information, and expose it via status command. New Features: - Implement get_active_display_info returning formatted display strings. - Extend status command to list active displays using the new function. Enhancements: - Improve console output for display information. - Update dependency usage for cleaner code. Bug Fixes: - None --- src/commands/display.rs | 24 ++++++++++++++++++++++++ src/commands/status.rs | 11 +++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/commands/display.rs b/src/commands/display.rs index f259ead..f7c2530 100644 --- a/src/commands/display.rs +++ b/src/commands/display.rs @@ -269,6 +269,30 @@ fn fetch_state() -> Option<(Connection, AppState, wayland_client::EventQueue Vec { + let mut infos = Vec::new(); + if let Some((_, state, _)) = fetch_state() { + for (_, head) in state.heads.iter() { + if !head.enabled { + continue; + } + let Some(current_mode_handle) = &head.current_mode else { + continue; + }; + let Some((_, mode)) = state.modes.get(current_mode_handle) else { + continue; + }; + + let hz = (mode.refresh as f64) / 1000.0; + infos.push(format!( + "{} ({}): {}x{} px, {:.3} Hz", + head.name, head.make, mode.width, mode.height, hz + )); + } + } + infos +} + fn show_refresh_rates() { if let Some((_, state, _)) = fetch_state() { for (head_handle, head) in state.heads.iter() { diff --git a/src/commands/status.rs b/src/commands/status.rs index e5f692a..c459501 100644 --- a/src/commands/status.rs +++ b/src/commands/status.rs @@ -1,3 +1,4 @@ +use crate::commands::display; use crate::hardware::gpu; use std::fs; use std::path::Path; @@ -179,4 +180,14 @@ pub fn execute() { } } } + + // Display Status + let displays = display::get_active_display_info(); + if displays.is_empty() { + println!("Display: Unknown / Firmware managed"); + } else { + for d in displays { + println!("Display: {}", d); + } + } }