mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-05-08 03:43:25 +02:00
feat(bar): support floating window title updates
This commit is contained in:
@@ -546,9 +546,12 @@ impl KomorebiNotificationState {
|
||||
self.layout = KomorebiLayout::Paused;
|
||||
}
|
||||
|
||||
let mut has_window_container_information = false;
|
||||
|
||||
if let Some(container) =
|
||||
monitor.workspaces()[focused_workspace_idx].monocle_container()
|
||||
{
|
||||
has_window_container_information = true;
|
||||
self.focused_container_information = (
|
||||
container
|
||||
.windows()
|
||||
@@ -565,6 +568,7 @@ impl KomorebiNotificationState {
|
||||
} else if let Some(container) =
|
||||
monitor.workspaces()[focused_workspace_idx].focused_container()
|
||||
{
|
||||
has_window_container_information = true;
|
||||
self.focused_container_information = (
|
||||
container
|
||||
.windows()
|
||||
@@ -578,7 +582,24 @@ impl KomorebiNotificationState {
|
||||
.collect::<Vec<_>>(),
|
||||
container.focused_window_idx(),
|
||||
);
|
||||
} else {
|
||||
}
|
||||
|
||||
for floating_window in
|
||||
monitor.workspaces()[focused_workspace_idx].floating_windows()
|
||||
{
|
||||
if floating_window.is_focused() {
|
||||
has_window_container_information = true;
|
||||
self.focused_container_information = (
|
||||
vec![floating_window.title().unwrap_or_default()],
|
||||
vec![windows_icons::get_icon_by_process_id(
|
||||
floating_window.process_id(),
|
||||
)],
|
||||
0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if !has_window_container_information {
|
||||
self.focused_container_information.0.clear();
|
||||
self.focused_container_information.1.clear();
|
||||
self.focused_container_information.2 = 0;
|
||||
|
||||
@@ -64,7 +64,6 @@ use crate::core::config_generation::IdWithIdentifier;
|
||||
use crate::core::config_generation::MatchingRule;
|
||||
use crate::core::config_generation::MatchingStrategy;
|
||||
use crate::core::config_generation::WorkspaceMatchingRule;
|
||||
use crate::winevent::WinEvent;
|
||||
use color_eyre::Result;
|
||||
use os_info::Version;
|
||||
use parking_lot::Mutex;
|
||||
@@ -309,10 +308,7 @@ pub fn notify_subscribers(notification: Notification, state_has_been_modified: b
|
||||
| NotificationEvent::Socket(SocketMessage::Theme(_))
|
||||
| NotificationEvent::Socket(SocketMessage::ReloadStaticConfiguration(_))
|
||||
| NotificationEvent::WindowManager(WindowManagerEvent::TitleUpdate(_, _))
|
||||
| NotificationEvent::WindowManager(WindowManagerEvent::Show(
|
||||
WinEvent::ObjectNameChange,
|
||||
_
|
||||
))
|
||||
| NotificationEvent::WindowManager(WindowManagerEvent::Show(_, _))
|
||||
);
|
||||
|
||||
let notification = &serde_json::to_string(¬ification)?;
|
||||
|
||||
@@ -363,6 +363,10 @@ impl Window {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn is_focused(self) -> bool {
|
||||
WindowsApi::foreground_window().unwrap_or_default() == self.hwnd
|
||||
}
|
||||
|
||||
pub fn transparent(self) -> Result<()> {
|
||||
let mut ex_style = self.ex_style()?;
|
||||
ex_style.insert(ExtendedWindowStyle::LAYERED);
|
||||
|
||||
Reference in New Issue
Block a user