Small fixes
This commit is contained in:
25
src/main.rs
25
src/main.rs
@ -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 {
|
||||
monitor: 0,
|
||||
active: ws.is_active,
|
||||
},
|
||||
)
|
||||
let workspace = Workspace {
|
||||
monitor: 0,
|
||||
active: ws.is_active,
|
||||
};
|
||||
(ws.idx, workspace)
|
||||
})
|
||||
.collect::<HashMap<_, _>>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user