2021/08/06

2021-08-06 07:03:37 +0200contessa(~contessa@2001:470:69fc:105::a9f)
2021-08-06 10:10:54 +0200nij-(~jin@2001-48F8-9021-806-0-0-0-1AD1-dynamic.midco.net)
2021-08-06 10:12:34 +0200 <nij-> Hi folks! Does anyone here know roughly how kmonad works under the hood? I'm quite amazed by what it can do. On arch, configuring the keys used to be a pain. I need to deal with a bad language and a config file with bad style. Sometimes it doesn't work as I expect, and it's hard to debug.
2021-08-06 10:13:05 +0200 <nij-> The fact that kmonad solves all of this makes me wonder what's the most important thing it does right. MOREOVER, it is portable!! Making it even more mysterious to me.
2021-08-06 10:18:09 +0200 <Solid> I suppose what simplifies things a lot is that we don't really care about environment-specific things like encoding (much like QMK)
2021-08-06 10:18:19 +0200 <Solid> we just read keycodes from uinput and do stuff with that
2021-08-06 10:19:02 +0200 <Solid> though as a result we are at the mercy of the specific environment when it comes to things like unicode entry
2021-08-06 10:20:23 +0200 <Solid> what else do we do right... I guess we're at least syntactically using a lisp for the config language; that must count for something :>
2021-08-06 10:22:51 +0200 <nij-> Using lisp is amazing! I wonder why kmonad team didn't start with lisp for its engine xD
2021-08-06 10:23:57 +0200 <nij-> About the keycodes - how does kmonad create a filter on top of other things that capture the key, modify as it wishes, and send to the lower levels?
2021-08-06 10:25:32 +0200 <Solid> The original configuration language was something else actually; some kind of hand-rolled, whitespace sensitive format. I think David changed it to be more lispy for ease of parsing mostly, but the dream at this point is to actually have a functioning (small) lisp for a config language
2021-08-06 10:26:47 +0200 <Solid> We manage to create a filter on top of other things by... not being on top of other things ;) We read directly from uinput (which is a kernel module) and create a new "virtual" keybord with that; this way we can capture every keypress before essentially any other process sees it
2021-08-06 10:27:34 +0200 <Solid> If you enter `evtest` in a terminal, you should see the keyboard that kmonad creates (with the name you've given it in your `uinput-sink`)
2021-08-06 10:44:23 +0200 <Tisoxin> nij-: As Solid sad, the config language isn't really a lisp
2021-08-06 10:44:49 +0200 <Tisoxin> There are no functions, general purpose variables, macros, etc.
2021-08-06 10:45:00 +0200 <Tisoxin> at least yet
2021-08-06 10:47:30 +0200 <Tisoxin> <nij-> "Using lisp is amazing! I..." <- Is this a request to explain which advantages Haskell has?
2021-08-06 10:48:10 +0200 <contrapunctus> nij-: oh hey, fellow Lisper.
2021-08-06 10:50:33 +0200 <nij-> hey contrapunctus :)
2021-08-06 10:50:47 +0200 <nij-> Tisoxin: pretty much yes! I wonder ..
2021-08-06 10:51:04 +0200 <nij-> Solid: Thanks for the explanation. That's really cool technique I should learn. Note taken!
2021-08-06 10:53:20 +0200 <Tisoxin> nij-: Since there are many dialects of lisp, i'm going to compare the usual properties of lisp with haskell
2021-08-06 10:54:57 +0200 <Tisoxin> The first thing that comes to my mind is static typing. It maybe controversial if static typing is better than dynamic typing, but imho static typing is essential for the paradigm “Make invalid states unrepresentable”.
2021-08-06 10:57:38 +0200 <Tisoxin> Another point is, that Haskells type system is very expressive, you can even capture the side effects of functions with it (This point is a bit simplified, since haskell is pure, so there exist no side effects)
2021-08-06 11:03:57 +0200 <Solid> I mean, the most obvious point would be that most lisps aren't actually functional languages (in the way that haskell is) ;)
2021-08-06 11:04:12 +0200 <Tisoxin> Further, Haskell is a lazy language, which increases expressiveness, so that haskell functions can do the same as some simple lisp macros (e.g. it is possible to implement an "if" function in haskell). Lazyness also allows clearer seperation of logic. (Though it can be a pain to reason about and it can increase memory consumption drastically)
2021-08-06 11:04:19 +0200 <Tisoxin> Solid: Yeah, that as well
2021-08-06 11:04:40 +0200 <Solid> clojure got that one settled a bit (having actually efficient implementation for map and friends)
2021-08-06 11:04:49 +0200 <Solid> but then people are aguing over whether clojure is actually a lisp
2021-08-06 11:04:50 +0200 <Tisoxin> Though there are many functional lisps, but they aren't pure
2021-08-06 11:05:07 +0200 <Tisoxin> Solid: Why shouldn't it be one?
2021-08-06 11:06:13 +0200 <Tisoxin> It has macros, functions and parentheses…
2021-08-06 11:06:32 +0200 <Tisoxin> Tisoxin: *mostly
2021-08-06 11:07:26 +0200 <Tisoxin> Clojure is just as functional as scheme. Nearly everything is functional, but if you want you can use atoms/"set!"
2021-08-06 11:07:38 +0200 <Solid> Tisoxin: something about it not being a "cons pairs are the only thing that exists" lisp from the ground up and thus essentially only being Java with a lispy syntax
2021-08-06 11:07:54 +0200 <Solid> I've also heard people complain that it has too much syntax (no joke :D)
2021-08-06 11:08:24 +0200 <Tisoxin> i can imagine that
2021-08-06 11:08:37 +0200 <Tisoxin> (since myself was confused about their usage of "#" in macros)
2021-08-06 11:08:47 +0200 <Tisoxin> * since I myself
2021-08-06 11:08:58 +0200 <Solid> (I'm not too deep into the whole lisp community---the only thing I write on a semi-regular basis is elisp---so I can only restate what I've heard as an outsider)
2021-08-06 11:09:01 +0200 <Tisoxin> But i don't think it's too much
2021-08-06 11:09:50 +0200 <Solid> also something something no reader macros I think
2021-08-06 11:10:12 +0200 <nij-> Those are all solid points. Thanks Tisoxin!
2021-08-06 11:10:16 +0200 <Solid> sorry, I didn't want to side-track you on Haskell vs. lisp
2021-08-06 11:10:30 +0200 <Tisoxin> np
2021-08-06 11:11:01 +0200 <nij-> I remember wanting to learn some haskell, and then I stumbled on a new book last year on complexity analysis of a purely functional lang.
2021-08-06 11:11:11 +0200 <nij-> It is so hard to reason.. so at the end I gave up.
2021-08-06 11:11:56 +0200 <nij-> On one hand, it scales up easily thanks to its type checker, but on the other hand, since the complexity is so hard to reason, it does seem harder to build larger programs.
2021-08-06 11:12:31 +0200 <Tisoxin> Do you mean O(n) and friends with complexity?
2021-08-06 11:12:36 +0200 <Solid> most functions where complexity really matters are probably written in a strict-ish way
2021-08-06 11:12:46 +0200 <Solid> which basically reduces the problem of reasoning about complexity to the imperative case
2021-08-06 11:13:52 +0200 <nij-> Bird's Algorithm Designs with Haskell
2021-08-06 11:14:30 +0200 <Solid> it's probably not something that one should read as their first haskell book ;)
2021-08-06 11:15:36 +0200 <Tisoxin> Solid: On List vs other data structures: https://guix.gnu.org/manual/en/guix.html#Data-Types-and-Pattern-Matching
2021-08-06 11:19:37 +0200 <nij-> I've read many about haskell xD
2021-08-06 11:19:53 +0200 <nij-> But I can't write clean code in it.. :(
2021-08-06 11:21:06 +0200 <nij-> So about kmonad.. I think it will allow me to detach my keybindings from my window manager.
2021-08-06 11:21:38 +0200 <Tisoxin> that's nice
2021-08-06 11:21:42 +0200 <nij-> In that I will no longer have to stick with one window manager, and it should work on any platform.
2021-08-06 11:21:52 +0200 <Tisoxin> sth i haven't thought about before
2021-08-06 11:22:28 +0200 <nij-> Yeah my dream is to have a running Lisp in background that handles all the logic.
2021-08-06 11:22:41 +0200 <nij-> Now kmonad takes almost full control of my keys.
2021-08-06 11:22:54 +0200 <nij-> With certain keypress, I can call certain functions in the Lisp.
2021-08-06 11:24:04 +0200 <nij-> Ah no.. I still have to tell the current wm what to launch to each key.
2021-08-06 11:24:30 +0200 <nij-> Haven't dived into kmonad yet - does it support calling certain shell script upon a certain key event happens?
2021-08-06 11:28:44 +0200 <Solid> yes, cmd-button allows for that
2021-08-06 11:34:09 +0200 <nij-> <3
2021-08-06 13:02:55 +0200fap[m](~fapmatrix@2001:470:69fc:105::cd11)
2021-08-06 13:14:35 +0200nij-(~jin@2001-48F8-9021-806-0-0-0-1AD1-dynamic.midco.net) (Remote host closed the connection)