mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-22 16:48:33 +02:00
fix(wm): update state for any new float rules
This update ensures that whenever a new float rule is added, the focused workspaces on all monitors will be checked to see if there are any currently managed windows which match that rule. If so, the matching window(s) will be removed from the workspace and the workspace will be updated. Matching windows on non-focused workspaces will not be removed, as these windows may be hidden, and removing them could result in these windows being inaccessible, requiring them to be killed before they can be relaunched fix #93
This commit is contained in:
24
Cargo.lock
generated
24
Cargo.lock
generated
@@ -84,9 +84,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "3.0.7"
|
version = "3.0.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "12e8611f9ae4e068fa3e56931fded356ff745e70987ff76924a6e0ab1c8ef2e3"
|
checksum = "31b34190c12bd1d613deba77e1cc13e68eaf4a0d51e389dbd485b7bfe15a47c0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@@ -483,7 +483,7 @@ dependencies = [
|
|||||||
"sysinfo",
|
"sysinfo",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-appender",
|
"tracing-appender",
|
||||||
"tracing-subscriber 0.3.5",
|
"tracing-subscriber 0.3.6",
|
||||||
"uds_windows",
|
"uds_windows",
|
||||||
"which",
|
"which",
|
||||||
"windows",
|
"windows",
|
||||||
@@ -1064,9 +1064,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.74"
|
version = "1.0.75"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
|
checksum = "c059c05b48c5c0067d4b4b2b4f0732dd65feb52daf7e0ea09cd87e7dadc1af79"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa 1.0.1",
|
"itoa 1.0.1",
|
||||||
"ryu",
|
"ryu",
|
||||||
@@ -1102,9 +1102,9 @@ checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.7.0"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
|
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
@@ -1147,9 +1147,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sysinfo"
|
name = "sysinfo"
|
||||||
version = "0.22.4"
|
version = "0.22.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ccb37aa4af23791c584202d286ed9420e023e9d27e49d5a76215623f4bcc2502"
|
checksum = "7f1bfab07306a27332451a662ca9c8156e3a9986f82660ba9c8e744fe8455d43"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"core-foundation-sys",
|
"core-foundation-sys",
|
||||||
@@ -1248,7 +1248,7 @@ checksum = "94571df2eae3ed4353815ea5a90974a594a1792d8782ff2cbcc9392d1101f366"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"time",
|
"time",
|
||||||
"tracing-subscriber 0.3.5",
|
"tracing-subscriber 0.3.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1305,9 +1305,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-subscriber"
|
name = "tracing-subscriber"
|
||||||
version = "0.3.5"
|
version = "0.3.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5d81bfa81424cc98cb034b837c985b7a290f592e5b4322f353f94a0ab0f9f594"
|
checksum = "77be66445c4eeebb934a7340f227bfe7b338173d3f8c00a60a5a58005c9faecf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ repository.
|
|||||||
Articles, blog posts, demos, and videos about _komorebi_ can be added to this list by PR:
|
Articles, blog posts, demos, and videos about _komorebi_ can be added to this list by PR:
|
||||||
|
|
||||||
- [Moving to Windows from Linux Pt 1](https://kvwu.io/posts/moving-to-windows/)
|
- [Moving to Windows from Linux Pt 1](https://kvwu.io/posts/moving-to-windows/)
|
||||||
- [Windows下的现代化平铺窗口管理器 komorebi](https://zhuanlan.zhihu.com/p/455064481)
|
- [Windows 下的现代化平铺窗口管理器 komorebi](https://zhuanlan.zhihu.com/p/455064481)
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use miow::pipe::connect;
|
|||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use uds_windows::UnixStream;
|
use uds_windows::UnixStream;
|
||||||
|
|
||||||
|
use komorebi_core::ApplicationIdentifier;
|
||||||
use komorebi_core::Axis;
|
use komorebi_core::Axis;
|
||||||
use komorebi_core::FocusFollowsMouseImplementation;
|
use komorebi_core::FocusFollowsMouseImplementation;
|
||||||
use komorebi_core::Layout;
|
use komorebi_core::Layout;
|
||||||
@@ -123,10 +124,57 @@ impl WindowManager {
|
|||||||
manage_identifiers.push(id);
|
manage_identifiers.push(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SocketMessage::FloatRule(_, id) => {
|
SocketMessage::FloatRule(identifier, id) => {
|
||||||
let mut float_identifiers = FLOAT_IDENTIFIERS.lock();
|
let mut float_identifiers = FLOAT_IDENTIFIERS.lock();
|
||||||
if !float_identifiers.contains(&id) {
|
if !float_identifiers.contains(&id) {
|
||||||
float_identifiers.push(id);
|
float_identifiers.push(id.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
let invisible_borders = self.invisible_borders;
|
||||||
|
let offset = self.work_area_offset;
|
||||||
|
|
||||||
|
let mut hwnds_to_purge = vec![];
|
||||||
|
for (i, monitor) in self.monitors().iter().enumerate() {
|
||||||
|
for container in monitor
|
||||||
|
.focused_workspace()
|
||||||
|
.ok_or_else(|| anyhow!("there is no workspace"))?
|
||||||
|
.containers()
|
||||||
|
.iter()
|
||||||
|
{
|
||||||
|
for window in container.windows().iter() {
|
||||||
|
match identifier {
|
||||||
|
ApplicationIdentifier::Exe => {
|
||||||
|
if window.exe()? == id {
|
||||||
|
hwnds_to_purge.push((i, window.hwnd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ApplicationIdentifier::Class => {
|
||||||
|
if window.class()? == id {
|
||||||
|
hwnds_to_purge.push((i, window.hwnd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ApplicationIdentifier::Title => {
|
||||||
|
if window.title()? == id {
|
||||||
|
hwnds_to_purge.push((i, window.hwnd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (monitor_idx, hwnd) in hwnds_to_purge {
|
||||||
|
let monitor = self
|
||||||
|
.monitors_mut()
|
||||||
|
.get_mut(monitor_idx)
|
||||||
|
.ok_or_else(|| anyhow!("there is no monitor"))?;
|
||||||
|
|
||||||
|
monitor
|
||||||
|
.focused_workspace_mut()
|
||||||
|
.ok_or_else(|| anyhow!("there is no focused workspace"))?
|
||||||
|
.remove_window(hwnd)?;
|
||||||
|
|
||||||
|
monitor.update_focused_workspace(offset, &invisible_borders)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SocketMessage::AdjustContainerPadding(sizing, adjustment) => {
|
SocketMessage::AdjustContainerPadding(sizing, adjustment) => {
|
||||||
|
|||||||
@@ -466,9 +466,11 @@ impl WindowsApi {
|
|||||||
let mut path: Vec<u16> = vec![0; len as usize];
|
let mut path: Vec<u16> = vec![0; len as usize];
|
||||||
let text_ptr = path.as_mut_ptr();
|
let text_ptr = path.as_mut_ptr();
|
||||||
|
|
||||||
unsafe { QueryFullProcessImageNameW(handle, 0, PWSTR(text_ptr), &mut len as *mut u32) }
|
unsafe {
|
||||||
.ok()
|
QueryFullProcessImageNameW(handle, 0, PWSTR(text_ptr), std::ptr::addr_of_mut!(len))
|
||||||
.process()?;
|
}
|
||||||
|
.ok()
|
||||||
|
.process()?;
|
||||||
|
|
||||||
Ok(String::from_utf16(&path[..len as usize])?)
|
Ok(String::from_utf16(&path[..len as usize])?)
|
||||||
}
|
}
|
||||||
@@ -543,7 +545,7 @@ impl WindowsApi {
|
|||||||
let mut monitor_info: MONITORINFO = unsafe { std::mem::zeroed() };
|
let mut monitor_info: MONITORINFO = unsafe { std::mem::zeroed() };
|
||||||
monitor_info.cbSize = u32::try_from(std::mem::size_of::<MONITORINFO>())?;
|
monitor_info.cbSize = u32::try_from(std::mem::size_of::<MONITORINFO>())?;
|
||||||
|
|
||||||
unsafe { GetMonitorInfoW(hmonitor, (&mut monitor_info as *mut MONITORINFO).cast()) }
|
unsafe { GetMonitorInfoW(hmonitor, std::ptr::addr_of_mut!(monitor_info).cast()) }
|
||||||
.ok()
|
.ok()
|
||||||
.process()?;
|
.process()?;
|
||||||
|
|
||||||
@@ -579,7 +581,7 @@ impl WindowsApi {
|
|||||||
Self::system_parameters_info_w(
|
Self::system_parameters_info_w(
|
||||||
SPI_GETACTIVEWINDOWTRACKING,
|
SPI_GETACTIVEWINDOWTRACKING,
|
||||||
0,
|
0,
|
||||||
(&mut is_enabled as *mut BOOL).cast(),
|
std::ptr::addr_of_mut!(is_enabled).cast(),
|
||||||
SPIF_SENDCHANGE,
|
SPIF_SENDCHANGE,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user