Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luajit Integration #259

Merged
merged 73 commits into from
May 15, 2021
Merged

Luajit Integration #259

merged 73 commits into from
May 15, 2021

Conversation

TimUntersberger
Copy link
Owner

@TimUntersberger TimUntersberger commented Apr 3, 2021

This PR will change the config language from our custom solution to lua.

TODO:

  • nog.workspace -> nog.ws_*
  • nog.window -> nog.win_*
  • implement plugin functions (nog.plugin -> nog.plug_*)
  • workspaces comp
  • padding comp
  • date/time comp -> datetime comp
  • active_mode comp
  • current_window comp
  • split_direction comp
  • fullscreen_indicator comp
  • default bar component layout is empty atm
  • nog.plug_uninstall currently doesn't work because of permission problems (nog.plug_uninstall is not working #270)
  • finish user data proxy implementations
  • refactor Event::ConfigError (now Event::LuaRuntimeError)
  • refactor Event::CallCallback
  • replace RuntimeResult with LuaRuntimeResult (same with RuntimeError)
  • refactor Event::ReloadConfig (Don't throw away the previous config and just rerun the lua file)
  • move hot reload to lua side (Might be added later on)
  • move mode impl to lua side
  • support setting bar components
  • properly namespace all functions
  • Change release from single exe to folder containig runtime files
  • remove leftover mode code on rust side
  • create download_release.ps1
  • remove functionality obsoleted by libuv
  • handle runtime errors in Event::CallCallback handler
  • event system (nog.on(...)) (will be added in another PR)
  • remove twm/init.lua
  • remove interpreter crate
  • move all nogscript related stuff into a separate repo
  • add default config

Documentation Todo:

  • Find out what the Api section should look like
  • The quick start guide should walk new users through operating nog based on the example configs (Documentation Feedback #106 (comment))
  • write api/components
  • add keys from Support numbered OEM key codes #261 to configuration/keybindings
  • write getting-started/work_mode
  • write getting-started/floating_mode
  • write getting-started/fullscreen_mode

* Add `kikito/inspect.lua` as a builtin function for debugging.
* Lua bar components are working
* Slowly removing nogscript
* Add SystemError -> LuaError conversion
* Add error handling
* Add error logging
* I tested all of the builtin components (Working)
* Add nog.unbind
@TimUntersberger
Copy link
Owner Author

I would like to hear some thoughts/ideas about the following points:

  • Moving modes to lua side
  • How should we write the api documentation in the future?
  • Should we have a small lua guide in our documentation or just reference to third party documentation?

cc @ramirezmike

@TimUntersberger

This comment has been minimized.

@ramirezmike
Copy link
Collaborator

I'll check this out more tomorrow but for this

Should we have a small lua guide in our documentation or just reference to third party documentation?

I definitely think reference third party documentation. No need to add more documentation work for us hah

@ramirezmike
Copy link
Collaborator

Moving modes to lua side

this is neat, but the amount of code feels like a lot to add to user configs. Would all that be added to the nog api in such a way that a user just needs do have this part in the config?

mode("resize", function()
  nog.bind("Escape", leave_mode)
end)

because if so, I'm cool with that. If not, would that be possible?

@TimUntersberger

This comment has been minimized.

@TimUntersberger
Copy link
Owner Author

TimUntersberger commented Apr 27, 2021

I managed to add support for c dlls and lua runtime files.

Any file that is inside the twm/runtime file gets copied into the release zip (like in neovim). I will add a powershell command which you just have to execute to install the zip locally for ease of use.

Right now we only have luv as an external c lib.

I just built the project and copied the resulting dll inside the twm/runtime/dll folder as luv.dll. Executing require "luv" now loads the dll correctly.

The structure of the release now looks like the following:

  • bin/nog.exe
  • runtime/dll/luv.dll
  • runtime/lua/inspect.lua
  • runtime/lua/runtime.lua (might rename to bootstrap.lua)

runtime.lua get executed automatically.

@ramirezmike
Copy link
Collaborator

I was checking out the docs, what is nog/docs/api/Display.html ? It's like a blank page

Also, here configuration/keybindings.html we might want to add the keys from #261?

I think the only things I have left that I want to test out is checking out how to do some sort of config value toggling/increment/decrement. I think that's been removed, is that right? Additionally, I think maybe we should just update the README with a section that is like "Converting config.ns to init.lua" and points to another file with more information based on my notes rather than including it in the official docs, what do you think?

@TimUntersberger
Copy link
Owner Author

TimUntersberger commented May 10, 2021

have left that I want to test out is checking out how to do some sort of config value toggling/increment/decrement. I think that's been removed, is that right?

Yep. I don't think there is any need for these functions anymore.

-- inc
nog.config.bar.height = nog.config.bar.height + 1
-- dec
nog.config.bar.height = nog.config.bar.height - 1
-- toggle
nog.config.work_mode = not nog.config.work_mode

Additionally, I think maybe we should just update the README with a section that is like "Converting config.ns to init.lua" and points to another file with more information based on my notes rather than including it in the official docs, what do you think?

👍

I was checking out the docs, what is nog/docs/api/Display.html ? It's like a blank page

Don't quite remember why this is here 😆. I will remove this.

@ramirezmike
Copy link
Collaborator

I added a small commit that adds a config.md file with a rough draft of some tips that I think could be useful. I think all that's missing are notes on rules, workspaces and modes.

I also added a change to twm/src/main.rs to create the config folder if it's missing. Feel free to make changes or move files if you'd like.

@TimUntersberger
Copy link
Owner Author

This seems to be ready to merge for me. Did you find anything else?

@ramirezmike
Copy link
Collaborator

This seems to be ready to merge for me. Did you find anything else?

I pushed one change (commented above) but aside from that I think it's good to go. Let me know if you agree with that behavior or not.

@TimUntersberger
Copy link
Owner Author

I agree 100%. Great work!

Thank god this is now over 😆

@TimUntersberger TimUntersberger merged commit 66e90c1 into master May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants