A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/trm.rs')
-rw-r--r--src/trm.rs40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/trm.rs b/src/trm.rs
index 9eee9a5..f55b4c0 100644
--- a/src/trm.rs
+++ b/src/trm.rs
@@ -11,25 +11,35 @@ pub fn toggle(at: &Path) {
_ = try bikeshed anyhow::Result<()> {
let l = LAST.load(Relaxed);
let mut niri = niri::socket::Socket::connect()?;
- let Ok(Ok(Response::FocusedWindow(Some(focused)))) = niri.send(Request::FocusedWindow) else { unreachable!() };
+ let Ok(Ok(Response::FocusedWindow(Some(focused)))) =
+ niri.send(Request::FocusedWindow)
+ else {
+ unreachable!()
+ };
if l != !0 {
- let Ok(Ok(Response::Windows(x))) = niri.send(Request::Windows) else { unreachable!() };
+ let Ok(Ok(Response::Windows(x))) = niri.send(Request::Windows)
+ else {
+ unreachable!()
+ };
_ = niri.send(Request::Action(Action::SetColumnDisplay {
- display: Normal
+ display: Normal,
}))?;
if x.iter().any(|x| x.id == l) {
- _ = niri.send(Request::Action(Action::FocusWindow { id: l }))?;
+ _ = niri.send(Request::Action(Action::FocusWindow {
+ id: l,
+ }))?;
// std::thread::sleep(Duration::from_millis(500));
// let Ok(Ok(Response::FocusedWindow(Some(x)))) = niri.send(Request::FocusedWindow) else { unreachable!() };
// dbg!(&x);
// if x.layout.window_size.1 < 200 {
- _ = niri.send(Request::Action(Action::SetWindowHeight {
- id: Some(l),
- change: niri::SizeChange::SetFixed(400),
- }))?;
+ _ =
+ niri.send(Request::Action(Action::SetWindowHeight {
+ id: Some(l),
+ change: niri::SizeChange::SetFixed(400),
+ }))?;
// }
- return
+ return;
}
// it died :(
}
@@ -39,14 +49,18 @@ pub fn toggle(at: &Path) {
.to_vec(),
}))?;
std::thread::sleep(Duration::from_millis(500));
- _ = niri.send(Request::Action(Action::ConsumeOrExpelWindowLeft {
- id: None,
- }))?;
+ _ = niri.send(Request::Action(
+ Action::ConsumeOrExpelWindowLeft { id: None },
+ ))?;
_ = niri.send(Request::Action(Action::SetWindowHeight {
id: None,
change: niri::SizeChange::SetFixed(400),
}))?;
- let Ok(Ok(Response::FocusedWindow(Some(ot)))) = niri.send(Request::FocusedWindow) else { unreachable!() };
+ let Ok(Ok(Response::FocusedWindow(Some(ot)))) =
+ niri.send(Request::FocusedWindow)
+ else {
+ unreachable!()
+ };
LAST.store(ot.id, Relaxed);
};
}