Small fixes

This commit is contained in:
2024-07-19 09:52:38 +02:00
parent 1a70e5772e
commit 125e996599

View File

@ -35,18 +35,15 @@ enum WindowManager {
}
static WM: Lazy<WindowManager> = Lazy::new(|| {
// SUPPORTED_COMPOSITORS="sway river Hyprland"
// if [ "${XDG_SESSION_TYPE:-""}" = "wayland" ] && \
// echo " $SUPPORTED_COMPOSITORS " | \
// grep -qi -e " ${XDG_CURRENT_DESKTOP:-""} " -e " ${XDG_SESSION_DESKTOP:-""} "
let session_type = env::var("XDG_SESSION_TYPE").ok();
if session_type.as_deref() != Some("wayland") {
return WindowManager::Unknown;
}
// TODO: might be relevant?
let _session_desktop = env::var("XDG_SESSION_DESKTOP").ok();
// might be relevant at some point
// let _session_desktop = env::var("XDG_SESSION_DESKTOP").ok();
let current_desktop = env::var("XDG_CURRENT_DESKTOP").ok();
match current_desktop.as_deref() {
@ -69,8 +66,6 @@ fn main() -> eyre::Result<()> {
Ok(())
}
// Map<i32, Workspace>
#[derive(Serialize)]
struct Workspace {
monitor: i32,
@ -87,19 +82,17 @@ fn handle_niri(command: Command) -> eyre::Result<()> {
.map_err(|e| eyre!("niri error: {e}"))?;
let niri_ipc::Response::Workspaces(workspaces) = reply else {
panic!();
bail!("Wrong response from niri: {reply:?}");
};
let workspaces = workspaces
.into_iter()
.map(|ws| {
(
ws.idx,
Workspace {
let workspace = Workspace {
monitor: 0,
active: ws.is_active,
},
)
};
(ws.idx, workspace)
})
.collect::<HashMap<_, _>>();