mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-10 07:02:44 +02:00
fix(cli): add monitor-information command
This commit adds a new monitor-information command to make it easier for people to find the values they need to use the display_index_preferences configuration option. re #860
This commit is contained in:
Generated
+3
-2
@@ -2408,6 +2408,7 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
"uds_windows",
|
"uds_windows",
|
||||||
"which",
|
"which",
|
||||||
|
"win32-display-data",
|
||||||
"windows 0.54.0",
|
"windows 0.54.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3819,9 +3820,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json_lenient"
|
name = "serde_json_lenient"
|
||||||
version = "0.1.8"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc61c66b53a4035fcce237ef38043f4b2f0ebf918fd0e69541a5166104065581"
|
checksum = "a5d0bae483150302560d7cb52e7932f39b69a6fbdd099e48d33ef060a8c9c078"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
|
|||||||
+7
-6
@@ -11,15 +11,16 @@ members = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
windows-interface = { version = "0.53" }
|
|
||||||
windows-implement = { version = "0.53" }
|
|
||||||
dunce = "1"
|
|
||||||
dirs = "5"
|
|
||||||
color-eyre = "0.6"
|
color-eyre = "0.6"
|
||||||
serde_json = { package = "serde_json_lenient", version = "0.1" }
|
dirs = "5"
|
||||||
sysinfo = "0.30"
|
dunce = "1"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
serde_json = { package = "serde_json_lenient", version = "0.2" }
|
||||||
|
sysinfo = "0.30"
|
||||||
uds_windows = "1"
|
uds_windows = "1"
|
||||||
|
win32-display-data = { git = "https://github.com/LGUG2Z/win32-display-data", rev = "2a0f7166da154880a1750b91829b1186d9c6a00c" }
|
||||||
|
windows-implement = { version = "0.53" }
|
||||||
|
windows-interface = { version = "0.53" }
|
||||||
|
|
||||||
[workspace.dependencies.windows]
|
[workspace.dependencies.windows]
|
||||||
version = "0.54"
|
version = "0.54"
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ pub enum SocketMessage {
|
|||||||
State,
|
State,
|
||||||
GlobalState,
|
GlobalState,
|
||||||
VisibleWindows,
|
VisibleWindows,
|
||||||
|
MonitorInformation,
|
||||||
Query(StateQuery),
|
Query(StateQuery),
|
||||||
FocusFollowsMouse(FocusFollowsMouseImplementation, bool),
|
FocusFollowsMouse(FocusFollowsMouseImplementation, bool),
|
||||||
ToggleFocusFollowsMouse(FocusFollowsMouseImplementation),
|
ToggleFocusFollowsMouse(FocusFollowsMouseImplementation),
|
||||||
|
|||||||
+1
-2
@@ -42,13 +42,12 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
|||||||
uds_windows = "1"
|
uds_windows = "1"
|
||||||
which = "6"
|
which = "6"
|
||||||
widestring = "1"
|
widestring = "1"
|
||||||
|
win32-display-data = { workspace = true }
|
||||||
windows = { workspace = true }
|
windows = { workspace = true }
|
||||||
windows-implement = { workspace = true }
|
windows-implement = { workspace = true }
|
||||||
windows-interface = { workspace = true }
|
windows-interface = { workspace = true }
|
||||||
winput = "0.2"
|
winput = "0.2"
|
||||||
winreg = "0.52"
|
winreg = "0.52"
|
||||||
|
|
||||||
win32-display-data = { git = "https://github.com/LGUG2Z/win32-display-data", rev = "2a0f7166da154880a1750b91829b1186d9c6a00c" }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
deadlock_detection = ["parking_lot/deadlock_detection"]
|
deadlock_detection = ["parking_lot/deadlock_detection"]
|
||||||
|
|||||||
@@ -797,15 +797,22 @@ impl WindowManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let visible_windows_state =
|
let visible_windows_state = serde_json::to_string_pretty(&monitor_visible_windows)
|
||||||
match serde_json::to_string_pretty(&monitor_visible_windows) {
|
.unwrap_or_else(|error| error.to_string());
|
||||||
Ok(state) => state,
|
|
||||||
Err(error) => error.to_string(),
|
|
||||||
};
|
|
||||||
|
|
||||||
reply.write_all(visible_windows_state.as_bytes())?;
|
reply.write_all(visible_windows_state.as_bytes())?;
|
||||||
}
|
}
|
||||||
|
SocketMessage::MonitorInformation => {
|
||||||
|
let mut monitors = HashMap::new();
|
||||||
|
for monitor in self.monitors() {
|
||||||
|
monitors.insert(monitor.device_id(), monitor.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
let monitors_state = serde_json::to_string_pretty(&monitors)
|
||||||
|
.unwrap_or_else(|error| error.to_string());
|
||||||
|
|
||||||
|
reply.write_all(monitors_state.as_bytes())?;
|
||||||
|
}
|
||||||
SocketMessage::Query(query) => {
|
SocketMessage::Query(query) => {
|
||||||
let response = match query {
|
let response = match query {
|
||||||
StateQuery::FocusedMonitorIndex => self.focused_monitor_idx(),
|
StateQuery::FocusedMonitorIndex => self.focused_monitor_idx(),
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ sysinfo = { workspace = true }
|
|||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
uds_windows = "1"
|
uds_windows = "1"
|
||||||
which = "6"
|
which = "6"
|
||||||
|
win32-display-data = { workspace = true }
|
||||||
windows = { workspace = true }
|
windows = { workspace = true }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|||||||
@@ -834,6 +834,9 @@ enum SubCommand {
|
|||||||
Gui,
|
Gui,
|
||||||
/// Show a JSON representation of visible windows
|
/// Show a JSON representation of visible windows
|
||||||
VisibleWindows,
|
VisibleWindows,
|
||||||
|
/// Show information about connected monitors
|
||||||
|
#[clap(alias = "monitor-info")]
|
||||||
|
MonitorInformation,
|
||||||
/// Query the current window manager state
|
/// Query the current window manager state
|
||||||
#[clap(arg_required_else_help = true)]
|
#[clap(arg_required_else_help = true)]
|
||||||
Query(Query),
|
Query(Query),
|
||||||
@@ -2144,6 +2147,9 @@ Stop-Process -Name:komorebi -ErrorAction SilentlyContinue
|
|||||||
SubCommand::VisibleWindows => {
|
SubCommand::VisibleWindows => {
|
||||||
print_query(&SocketMessage::VisibleWindows.as_bytes()?);
|
print_query(&SocketMessage::VisibleWindows.as_bytes()?);
|
||||||
}
|
}
|
||||||
|
SubCommand::MonitorInformation => {
|
||||||
|
print_query(&SocketMessage::MonitorInformation.as_bytes()?);
|
||||||
|
}
|
||||||
SubCommand::Query(arg) => {
|
SubCommand::Query(arg) => {
|
||||||
print_query(&SocketMessage::Query(arg.state_query).as_bytes()?);
|
print_query(&SocketMessage::Query(arg.state_query).as_bytes()?);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user