i3 configuration in Haskell - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Sridhar Ratnakumar

Idea for a fun project, if you use i3 in particular. Write a way to configure i3 that is fully type-checked. Eg. as Haskell code (or Dhall) that compiles to the i3 configuration file. Kind of like xmonad, but compiles to conf file instead of executable. Bonus points for IDE support via Language Server Protocol (autocomplete, etc.); well, if we use Haskell that's automatically ensured by haskell-language-server?

tristanC

Dhall also features a LSP implementation that can provides autocompletion, and it is working quite well without any configuration.

Bolt

That would be indeed a interesting project

Sridhar Ratnakumar

There is a 4 years old attempt here: https://github.com/vlad-shatskyi/i3wm-config-haskell

A DSL for writing type-safe and convenient i3 configs. - vlad-shatskyi/i3wm-config-haskell
Sridhar Ratnakumar

Can we free monads (polysemy) to define this DSL?

Sridhar Ratnakumar

If we have a library/app like this, we can extend it further by enabling people to write "plugins" in Haskell.

Sridhar Ratnakumar

Actually, that can also happen independent (at runtime) via https://github.com/leshow/i3ipc#readme

Types and bindings for communicating with i3 in Haskell - leshow/i3ipc
Kampouse

Why would one bind i3 when there xmonad :flushed:

Sridhar Ratnakumar

Last I tried xmonad was as a Haskell n00b. I couldn't figure out flexible colums layout like you can do in i3. Maybe I should give it another try.

Sridhar Ratnakumar

btw, whatever happened to https://github.com/waymonad/waymonad ? seems like inactive for a year

A wayland compositor based on ideas from and inspired by xmonad - waymonad/waymonad
Kampouse

Abandonned i guess :shrug:‍♂️

Kampouse

Am probably one of the person that know the least haskell and manage to make work Xmonad :wink:

TheMatten

Sridhar Ratnakumar said:

Last I tried xmonad was as a Haskell n00b. I couldn't figure out flexible colums layout like you can do in i3. Maybe I should give it another try.

I found https://unix.stackexchange.com/questions/48679/how-do-i-enable-a-three-column-layout-in-xmonad

I'm a Haskell and XMonad beginner. I'm trying to set up my tiling layout to allow three side by side columns (so that I can have three simultaneous tall and thin Vim instances for coding, per works...
TheMatten

BTW, how does XMonad work actually? xmonad.hs is the WM itself, or it's used by XMonad to load config and custom features in some way?

Mats Rauhala

xmonad.hs:

main :: IO ()
main = xmonad defaultXConfig{...}

so it's the WM itself, taking a configuration value

Sridhar Ratnakumar

@TheMatten Just 3? Not 4? In i3 you hit Ctrl+h and it opens the new windows across horizontally. No limits to number of columns or rows, hence "flexible". But I'll give xmonad another try, now that I'm comfortable with Haskell; it probably will require substantial Haskell code to get it to do what I want.

Sridhar Ratnakumar

I also want to edit my xmonad configuration (xmonad.hs) using haskell-language-server for full IDE support. I smell an awesome blog post coming ...

Sridhar Ratnakumar

"Edit your WM configuration with autocomplete, etc. Can your WM do this?"

TheMatten

Sridhar Ratnakumar said:

TheMatten Just 3? Not 4? In i3 you hit Ctrl+h and it opens the new windows across horizontally. No limits to number of columns or rows, hence "flexible". But I'll give xmonad another try, now that I'm comfortable with Haskell; it probably will require substantial Haskell code to get it to do what I want.

I looked through xmonad-contrib and there seems to be one more layout - https://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Layout-MultiColumns.html

Sridhar Ratnakumar

Kampouse said:

Why would one bind i3 when there xmonad :flushed:

Thanks for the nudge; I'm now a proud Xmonader :grinning:

https://www.srid.ca/xmonad-conf-ide.html

Kampouse

:flushed: sorry :joy: