A Tiling Window Manager for Windows, Written in Janet
Hi HN!
I read[1] about Janet[2] some time ago, then immediately got impressed by the enthusiasm of its community, and by the language itself, so I started playing with it.
At the time I was searching for a tiling window manager for Windows, and unavoidably the idea of scratching my own itch with Janet got hold of me, so Jwno was born.
Simply put, Jwno is a keyboard-driven tiling window manager for Windows, scriptable with Janet. But since it has a complete Lisp runtime, and a thin wrapper library for Win32 APIs[3], you can certainly do much more with it.
I hope you'll enjoy playing with it as much as I enjoyed building it.
And yes, I use StumpWM on the Linux side, by the way.
I've recently started playing around with Janet, and it's a great language. I think it's inspired by Clojure and Lua, and somehow manages to be better than both (in my opinion).
I think it's inspired by Clojure and Lua, and somehow manages to be better than both
This is exactly how I feel about Janet too. I don't think I have enough experience on Clojure or Lua to comment on them, but I got attracted to Janet almost immediately.
Working on Jwno also confirms my first impression on Janet: It's really a practical language. The tooling has some room for improvement, but the language itself can get things done - usually fast and easily.
I feel weird using a Lisp that is not as interactive as Racket, Scheme or Common Lisp
I think Racket and Scheme don't belong in there because neither has a REPL as powerful and "interactive" as Common Lisp REPL. They don't support images either (but Janet and CL do).
This is, of course, just a part of a larger whole - the fact that your Common Lisp program ships with a compiler it can access and effectively always runs in an edit-and-go debugger. Embracing this fact fully leads to a different workflow of software development.
Having done a bit of that, I found plenty of drawbacks of this approach, too - mostly various consequences of breaking the assumption that code that a program is running is the same as the code it was compiled from or that it started with. The aspect that annoyed me the most day-to-day was, basically, that whenever I fixed something on the fly through conditions and restarts and eval-ing code in a REPL, I never had a nice way to go back to that solution and port it to code. It was too easy to forget about a quick fix you did without thinking.
I now realized this should be easily fixable with external tooling - i.e. in Emacs/SLIME. What I think they need is a better way of keeping an audit trail. Capturing and persisting as much of the transient interactions you did as possible, letting you revisit them after and easily transfer into code or tests.
I now realized this should be easily fixable with external tooling - i.e. in Emacs/SLIME. What I think they need is a better way of keeping an audit trail. Capturing and persisting as much of the transient interactions you did as possible, letting you revisit them after and easily transfer into code or tests.
To some extent, undotree on neovim allows this because it offers a drastically different view on what "undo" means. But I agree with you, the lack of a git-like system is annoying. I even think this might be THE reason CL didn't catch on—companies want to keep track of things (hence all the dashboards and ticketing systems...).
What I meant though isn't collaborative/historical tracking, I meant day-to-day ergonomics; closer to "drastically different view on what 'undo' means", except it doesn't even have to be 'undo' - I don't need the ability to rollback every single thing; I just want to know whatever the hell I actually did an hour ago when I quickly SET-VALUE and IGNOREd my way through a few random condition popups and evaluated some code in between. Being careful and keeping track of this as I go slows me down and is kind of the opposite of REPL-driven interactive development ideas; nah, I should be able to go fast now, and later be able to review all the random surgery I did on a live image.
EDIT:
undotree on neovim allows this because it offers a drastically different view on what "undo" means
As I understand it, this "different view" is treating undo history as a tree? If so, I know this from Emacs via similarly named `undo-tree' package. But honestly, the moment I saw this I thought this is brain-dead stupid most obvious way of treating undos. It's very unfortunate that almost no software embraces this approach, instead opting for a linear history that gets trimmed the moment you undo a few steps and make a change.
If you want to see a truly different view of undo, check out what Emacs does by default. I don't even understand it fully, but best I can tell after studying the explainer in undo-tree's documentation, is that Emacs is using a linear history like everyone else, but instead of moving back through the history and discarding "the future" when you branch out, `undo' itself is an undoable operation that gets appended to undo history, so when you type some things, undo it, type something else, and keep pressing undo, you'll erase the last text, then "undo the undo" and end up with the first thing you typed...
Version control is tricky with image-based systems
Back in the day:
ENVY/Manager augments this model by providing configuration management and version control facilities. All code is stored in a central database rather than in files associated with a particular image. Developers are continuously connected to this database; therefore changes are immediately visible to all developers.
https://www.google.com/books/edition/Mastering_ENVY_Develope...
These days:
Package files are simple text files, encoded for latin alphabet (ISO 8859-15) and handled without problems by GitHub. Cuis-Smalltalk uses the LF (ascii code 10) newline convention, as preferred in GitHub. This allows Git/GitHub to diff versions, and merge branches.
Yeah, it's mind-blowing when it clicks, and makes the whole "exceptions vs. return types" discussion look like a quarrel of 3yos in a sand box. Error handling in other languages/runtimes just doesn't feel sufficient from now on.
I am still waiting for a non-Lisp language with a half-decent restart system. Even compiled languages should be able to implement it (except dealing with a possible allocation failure when saving the register context to return to)
"Restart. Start execution of the current method from the beginning. You can edit a method shown in the code pane, save it, and restart it!"
5. Code that signals a file read error
4. Code that installs restarts "re-read line" and "skip line"
3. Code that loops over files in line
2. Code that installs restart "re-read file" or "abort"
1. Code with the handler that intelligently chooses whether to resume from 4 by re-reading a line or skipping it, or resume from 2 by attempting to read the file again, or just bailing out.
I mean, Common Lisp is still the gold-standard for me, but reading about Hoot recently really made me want to check Guile out a bit more (CL does not have much in the way of lovely WASM stories right now) and, honestly, I was super impressed. I think if the interactive experience of developing in Hoot in the browser matched the interactive experience of developing in native Guile, I'd be a pretty happy convert.
(it's beta so it has a few little annoyances still)
The one thing I’ve noticed is that it seems like Janet had a burst of interest 2020-2022 but it has since slowed down. Would love to see it become popular again. The main reason I’m using it is because I like how it’s both powerful and lightweight. I’d use clojure but I don’t want Java. I’m tempted to also try Common Lisp but so far Janet has been great.
Maybe the most "opinionated" things in Janet are the ev stuff and fibers. I think they're done right though, you just need to be careful with the event loop when embedding Janet.
The UI hints also look promising, but I can't get them working. Using example-config.janet I tried pressing RAlt or RAlt+K and I get the UI hint shortcuts list coming up, but none of them seem to do anything, except in Notepad where I sometimes get the standard UI hints (that always come up here with a long press of left alt)
Fwiw, as a newbie I found it a bit intimidating/off-putting that it doesn't work out the box without choosing a config file. That's quite a lot of extra cognitive effort and link-clicking before you can try it out. And I'm left quite unsure what I'm missing out on. Am I able to access the different documented features with the config file I have? It's not clear.
Having tiling options that fit within a smaller part of the screen (e.g. still allow side by side or top/bottom split, but in a smaller total region) would be great.
Do you mean reserving screen space for the on-screen keyboard? If that's the case, you can try to "transform" the top-level frame (a frame that tracks a monitor's screen area), either in the REPL or in your config: https://agent-kilo.github.io/jwno/cookbook/adjust-top-level-...
Using example-config.janet I tried pressing RAlt or RAlt+K and I get the UI hint shortcuts list coming up, but none of them seem to do anything
Can you please file a bug report and attach relevant logs? You can write logs to a file by starting Jwno like this:
jwno.exe --log-file C:\jwno.log --log-level debug --no-console your-config.janet
There should be some interesting logs when you press one of the UI hint shortcuts.
Fwiw, as a newbie I found it a bit intimidating/off-putting that it doesn't work out the box without choosing a config file. That's quite a lot of extra cognitive effort and link-clicking before you can try it out.
I totally understand. But I chose to not include a default config in the executable, because I thought a window manager is a... personal thing. It should evolve with your habits and workflows, so the default config will most likely get changed to something dramatically different anyway. I can be wrong though.
I ran jwno with example-config and pressed RAlt and RAlt+K a few times, each time trying one of the onscreen shortcut keys (b, c, d, etc). Log at the bottom of this comment. At the end of the process I was left in a state where pressing Space triggered a context menu in my title bar, and I couldn't type space in the app (e.g. in Notepad or Terminal) which I think is due to one of the Alts ending up being held down? It persisted after leaving Jwno
Sorry for the confusion. I think switching to another leader key, such as LAlt or RCtrl, should fix the issue.
The first thing I tried was in my browser, I asked for all the buttons and it labelled the 'x' to close each tab, but where the labels were laid out it just looked like an inviting right-aligned label on the clickable tabs themselves. Lost a few tabs before I realised, because you also don't see any feedback on the click since any UI feedback is hidden by the label. Hmm. Food for thought.
An offset would be nice, though I'm sure it's not easy to define a heuristic that works in all places.
I agree. I considered dynamic offsets, in an effort to declutter the labels, but found it even more confusing. Maybe I should do more experiments on this.
but where the labels were laid out it just looked like an inviting right-aligned label on the clickable tabs themselves
The labels are left-aligned by default (except in `frame-hinter`). I think you can try some combinations of the `:anchor` and `:show-highlights` options[1] to see if they work better for you.
[1] https://agent-kilo.github.io/jwno/ref/built-in-modules/jwno-...
Edit: Wrong link
Meanwhile you can try to change leading `RAlt` to something else, like `Win + H`, and see if it works. There may be a bug that gets triggered when only modifier keys are mapped.
I tried various lisp dialects, but I could never find the killer feature vs other languages I already use. And I can justify why I use these specific languages I do use, if that makes sense.
I think Jwno's REPL module is so important, I specifically changed Jwno's architecture at one point to make it work.
I find the REPL and interactive development workflow invaluable. A window manager is a long-running background service by nature, and has a lot of accumulated runtime states. The ability to peek inside and debug while the process keeps running helped me a lot when building Jwno.
Sure, but any particular reason you picked Janet over Common Lisp? They both support images, REPL, hot-code-reloading, etc.
I could never find the killer feature vs other languages I already use.
You're kidding or trolling? Structural editing and the REPL are the greatest features of Lisp. The ability to just grab any expression and move it around simplifies so many things when coding and refactoring. With the connected REPL you can eval anything on the spot, that turns the entire experience of coding into a video game — you don't need to wait for linter, linker, compiler — you just run things. You often don't even have to save anything. I suspect when you "tried various lisp dialects" maybe you didn't use structural editing and the connected REPL?
Often people confuse Lisp REPL with REPLs in other programming languages, e.g. Python, where usually you have to copy-n-paste chunks of code into it. Lisp's REPLs are different in the sense that every step in Read-Eval-Print-Loop is different — in Lisp, you typically eval things right where you type them, by sending whole expressions to the connected REPL, which could be remote. We (for example) run ours in a Kubernetes cluster, that allows us to experiment with pods, running queries against the "real" DB tables, testing services "live".
There already is a LispSyntax.jl but it's sort of trying to be a Clojure clone and I don't care for it, haha.
It's a quick-and-dirty PoC with lots of caveats and limitations though. E.g. it works only for a single monitor. I don't think we can clip windows to a "view port" on Windows (the OS), so this may never be as nice as PaperWM, Niri etc.
I start explaining, very carefully, like I'm talking to a child, that this is an alternative shell, which replaces the standard Windows Explorer et cetera, und so weiter... it's very complicated you know...
Guy says, "cool... hey, why don't you check out this URL?". I do. It's the litestep contributor page. His nick is on it. Near the top.
Ow.
I mean, I remember there being a whole ton of wildly customized windows shells with menus and floating terminals and so on, but not a single thing stuck around?
Besides, the term innovation is used far too much with respect to software, in the sense that a lot of stuff can be traced back much further than the so-called innovators will suggest. Many ideas have deep roots, but it took several (often independent) attempts until the technology or its users were ready for it.
Ironically, 90% of use I get from them is remapping Caps Lock to CTRL. Which I historically did with AutoHotkey, which was much lighter, but then there's the 10% of the time I need something else from PowerToys...
Windows DESPERATELY needs a more powerful built-in manager. It's ridiculous to use the mouse all the time.
And yet, I find Windows window management far more advanced than macOS. It's ridiculous that up until recently, macOS didn't even have basic max-size functionality w/o reaching for 3rd party apps.
(Browsers, in particular, I use full-screen less and less. That annoying trend of squeezing everything into short lines "because readability" is just wasting too much screen space; zooming in makes everything too big, and I'm getting tired of writing userstyles or userscript to fix it for every other page I open, so I'm back to keeping 2 or 3 columns of windows running.)
Also, any excuse to use more Lisp is good in my book. Based on the screenshots, it looks stellar; if it works half as well as it comes across, I'll switch over instantly.
My StumpWM is heavily customized though, and I mostly modeled Jwno's behavior after my own config, so it may not be what you expected at all.
But that's one of the reasons I like Lisp and things built in Lisp: They are so flexible, you can sometimes build something based on the original thing, while it feels completely different from the original.
my monitor seems just the right shape/resolution for the standard Windows splits to be suboptimal
Do you use an ultra-wide? In that case, Jwno has no OOTB ultra-wide support, but there's a section for adjusting it in the cookbook[1].
[1] https://agent-kilo.github.io/jwno/cookbook/adjust-top-level-...
Do you use an ultra-wide? In that case, Jwno has no OOTB ultra-wide support
Actually no, I'm using two regular, 16:19, 2560x1440 screens. It's more that my understanding of readability does not agree with what designers think, and when I split the screen in half, many pages end up with text a little too small for my comfort, and if zoom in to compensate, the lines get slightly too short or horizontal scrollbar appears.
(I'd guess it's probably my somewhat strong myopia glasses that are getting me "out of alignment" from average user when it comes to text size and line length preferences.)
but there's a section for adjusting it in the cookbook[1].
Lovely!
FWIW, I took it for a spin briefly (only briefly - had work to finish, but I plan on getting back to it) and I was pleasantly surprised by how good it is, and how well it handles Windows quirks. It feels nicer than StumpWM did back when I used it. The only thing that didn't work well was VLC - it does something weird with recreating its window when switching between videos, and in the process, it "breaks out of confinement" and ends up returning to original size and position it had before Jwno took custody of it.
* By default, Komorebi uses dynamic tiling, while Jwno uses manual tiling.
* Komorebi has workspaces, Jwno works with Windows native virtual desktops instead.
* Komorebi uses IPC and native system command line to send commands, while Jwno usually operates all by itself.
There are definitely other details that are important to you, but these are the things that immediately came to my mind. I don't run Hyprland so can't really comment on that.
For example, GIMP works without any issues. And the productivity boost is tremendous, for me it's very hard to work on anything else. I barely encounter programs where it does more harm than use.
Especially having multiple desktops with different names allow me to localize windows so much quicker than looking through a dozens of terminals manually.
Right now, I do have: 1 mail, 2 web, 3 gimp, 4 chat, 5 notes, 6 terminal, 7 ssh cluster
I use StumpWM, and for the few applications that this becomes a real problem it is possible to run those in a floating windows group that works just like a minimalistic non-tiling window manager. I think this is a common features of tiling window managers.
The Windows tiling window manager development scene is a very kind, relaxed and collaborative space where we all take inspiration from and support each other
The Linux scene isn't bad either (or at least it wasn't 4+ years ago when I was into this); I've used StumpWM as a daily driver for many years, and while it was definitely niche, I still saw friendly exchange of ideas and experiences with people using and/or contributing to dwm, i3, and ratpoison.
(Then there's EXWM, but I never really mustered the courage necessary to try it.)
You can implement custom commands and hooks to trigger. It's even possible to call native Win32 APIs in your own implementations. For example, to always move a Notepad window to the (100, 100) coordinates on your screen(s), using the low-level SetWindowPos function
Great job. Looks really interesting and useful. And a fun excuse to write Lisp.
I really appreciate it when APIs give you high-level functionality but keep the door open to lower-level APIs when you really need them.
Jwno's internal data structure has these levels (higher-level comes first):
Root - Virtual Desktops - Monitors - Normal Frames - Windows
So monitors are part of a virtual desktop, and every virtual desktop has the same layout that reflects your physical monitor arrangement. When you switch virtual desktops, all monitors switch to the new desktop at the same time.
[1]https://agent-kilo.github.io/jwno/frame-tree/frame-nodes.htm...
[2] https://github.com/agent-kilo/jwno/blob/master/example/tutor...
I learnt Janet after learning Clojure, and it all felt very natural. So a possible approach is to grab a beginner Clojure book/tutorial first, run some of the examples, and then see how far you get with Janet.
Not everything is the same, but you'll find that out along the way, and the people in the Janet Zulip chat are always super helpful.
Also check out https://janetdocs.com for some examples.