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

Add API to control from the outside #54

Open
Xenira opened this issue Oct 20, 2023 · 18 comments
Open

Add API to control from the outside #54

Xenira opened this issue Oct 20, 2023 · 18 comments
Assignees
Labels
enhancement New feature or request

Comments

@Xenira
Copy link
Contributor

Xenira commented Oct 20, 2023

Is your feature request related to a problem? Please describe.

#22 discusses different ways of changing the ding to ding after n characters.
While using different keys to determine the current column this will always have a bit of inaccuracy.

I propose to add a way to control daktilo from the outside to give editors the opportunity to report the current cursor position and/or line length.

Maybe other use cases for controlling the app from the outside might also arise in the future (e.g.: changing preset based on current project/application).

Describe the solution you'd like

I'd like to implement an api allowing external applications to control the running daktilo process.

For this one could use different ways of communication:

  1. (g)RPC
  2. Pipes
  3. Rest API

My prefered solution would probably be gRPC. While named pipes would be a really simple way of handling this the other methods probably scale a lot better.

The api should probably be disabled by default and can be enabled using the config file.

Describe alternatives you've considered

Programs could include a lib version of this project. This would have several drawbacks:

  1. If multiple programs do this each would be playing their own sound causing overlap
  2. Config per program would be required
  3. Programs would need to update daktilo lib and might have different versions (unless dynamic linked, but that would just add further complexity and breaking changes would break the libs till update)

Additional context

I'm investing way to much time into this and prob. over-engineering this. Please feel free to tell me if I am going too far 😜

@Xenira Xenira added the enhancement New feature or request label Oct 20, 2023
@Xenira
Copy link
Contributor Author

Xenira commented Oct 20, 2023

Another alternative would be to use daktilo as a lib in something like a daktilo-server project.

That would keep this project clean and allow someone to install the server version if they want the additional functionality.

@Xenira
Copy link
Contributor Author

Xenira commented Oct 25, 2023

@orhun any preferences on this? I have the basics done using gRPC (116f94b has the poc), just need to refactor based on how you would like this to be integrated.

  • If this should be integrated in this project ill add config options and add proto to this repo
  • Otherwise ill create a new daktilo-server repo that handles the gRPC server and proto. In that case I might need to create a MR to allow me to send custom events

@orhun
Copy link
Owner

orhun commented Oct 26, 2023

Hey, thanks for creating this issue, and no, sounds like a good feature rather than an overengineered thing :D

My prefered solution would probably be gRPC. While named pipes would be a really simple way of handling this the other methods probably scale a lot better.

I would honestly go for the pipe implementation since it is more low level and a bit easier to communicate from simple processes. But I'm not against gRPC, it is also a fine approach. Will definitely want to support pipes in the future based on how easy it will be the gRPC implementation will be though.

I have the basics done using gRPC

That's great!

I think we can have the server in this repo by converting the project into a workspace (so we will have 2 workspace members - daktilo & daktilo-server). How does that sound?

@orhun
Copy link
Owner

orhun commented Oct 26, 2023

I also think we should have an example for showing what you can achieve with the daktilo API. Maybe we can somehow make #22 happen?

@Xenira
Copy link
Contributor Author

Xenira commented Oct 26, 2023

I think we can have the server in this repo by converting the project into a workspace (so we will have 2 workspace members - daktilo & daktilo-server). How does that sound?

I would split it into 3 while we are at it. Cli, Lib and Server.

Ill look into a convenient way to allow both pipe and gRPC.

@orhun
Copy link
Owner

orhun commented Oct 26, 2023

Sounds good!

Xenira added a commit to Xenira/daktilo that referenced this issue Oct 28, 2023
Xenira added a commit to Xenira/daktilo that referenced this issue Oct 28, 2023
@Xenira
Copy link
Contributor Author

Xenira commented Oct 28, 2023

Added a repo for simple nvim plugin here: https://github.com/Xenira/daktilo.nvim

Already started to add the server here: https://github.com/Xenira/daktilo/tree/daktilo-server

Will wait for #66 to be ready before going further though. Atm this setup won't do anything (except printing an error message i guess) and the server code is not integrated yet.

Edit: Probably also need to create a shared / common crate to avoid circular dependencies.

@orhun
Copy link
Owner

orhun commented Nov 2, 2023

Damn that looks awesome, definitely look forward to using it in my setup :D

I added some comments in #66, will try to get to your feedback rather quickly so that we can move forward with the server part.

@orhun
Copy link
Owner

orhun commented Nov 5, 2023

Now that #66 is merged we can move forward!

@orhun
Copy link
Owner

orhun commented Nov 11, 2023

Do you think I should create a release with the current changes or wait for this issue to be resolved?

@Xenira
Copy link
Contributor Author

Xenira commented Nov 11, 2023

As there is no real functional change i guess a release is not needed rn.
Will try to create a MR today or tomorrow with the api.

@Xenira
Copy link
Contributor Author

Xenira commented Nov 13, 2023

Didn't manage to get it done during the weekend. Prob. need till next weekend to finish this.

@orhun
Copy link
Owner

orhun commented Nov 13, 2023

Sounds good!

@orhun
Copy link
Owner

orhun commented Dec 11, 2023

ping ping

@Xenira
Copy link
Contributor Author

Xenira commented Dec 14, 2023

Hey, sorry life got in the way and then the nvidia drivers bricked my linux install. Got it running again and will continue with this.

@orhun
Copy link
Owner

orhun commented Dec 14, 2023

Great, it would be nice to have a new release with this change!

nvidia drivers bricked my linux install

damn, what happened? :o

@Xenira
Copy link
Contributor Author

Xenira commented Dec 14, 2023

Had an issue with stuttering on both x11 and wayland, then tried to downgrade...
Did something wrong and corrupted stuff. And of course my backups were up to date 🤥

@orhun
Copy link
Owner

orhun commented Jan 5, 2024

Happy new year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants