termonad icon indicating copy to clipboard operation
termonad copied to clipboard

xmonad-like reconfigure

Open KonstantinDjairo opened this issue 1 year ago • 3 comments

is it possible to add a easier command for reconfigure? like xmonad's one

$ xmonad --recompile

something like this, or provide any way of doing it without stack or cabal, for users that rely solely on their package managers...

edit: here's the recompile function from xmonad:

KonstantinDjairo avatar Oct 25 '24 00:10 KonstantinDjairo

Sorry for taking a while to respond to this, I completely forgot about it!

A couple random thoughts:

  • When launching Termonad, it will do a recompile, but I guess you're asking specifically for a way to try to recompile ~/.config/termonad/termonad.hs without needing to actually launch Termonad? That seems reasonable.

  • Internally Termonad uses dyre to do the whole "recompile from a Haskell source file" thing. Maybe dyre has some functionality built-in to make this easy to implement in Termonad??

  • XMonad has a restart function which will attempt to recompile your xmonad.hs file if it has changed, re-exec the new XMonad binary, and can also carry forward your current state (like which windows are on what workspace, window sizes, etc).

    Termonad doesn't have this ability, and likely can't, since it can't serialize the state of a given terminal to disk. (For instance, if you have Vim running in one terminal window, there is no way to "serialize" it's state to disk and restart it.)

cdepillabout avatar Jan 20 '25 19:01 cdepillabout

no worries.

yes, Dyre has some functionalities that can help, but as we're in haskell , there's always a way to make what we want. the thing is, which path is the shortest ? and i think you're thought about Dyre can leads us to a good direction , since there are indeed some helper functions , we can maybe modify them to take another file as argument, and this file will apply transformations on Termonad's code

you'd be indirectly coding in termonad source... ;)

edit: since you've mentioned thr way that xmonad does it, there's actually a pretty easy way to make it work for termonad

you'd have a function that raises a new instance of termonad, like spawning a process after calling the recompilation

since the "old" instance is in memory, this wouldn't actually crash or break

KonstantinDjairo avatar Jan 21 '25 03:01 KonstantinDjairo

taffybar seems like a good example on how to achieve this: https://github.com/taffybar/taffybar/blob/b256a711416036ca124fc9b3f89e7c957535e465/app/Main.hs#L46-L57

KonstantinDjairo avatar Oct 25 '25 17:10 KonstantinDjairo