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

modify drawing tool from the command line #187

Open
pascal-niklaus opened this issue Feb 21, 2024 · 1 comment
Open

modify drawing tool from the command line #187

pascal-niklaus opened this issue Feb 21, 2024 · 1 comment

Comments

@pascal-niklaus
Copy link
Contributor

I use drawing/annotation tools for teaching.

It would be great to be able to change the drawing tool from the command line, while the server is running. This would allow, for example, to use an external keypad with presets assigned to individual keys. A software like Keebie or actkbd could then be used to execute gromit-mpx with particular options, allowing to quickly switch the default tool. Alternatively, users could define keyboard shortcuts in their particular desktop environment (KDE, Gnome), and link them to particular gromit options. That way, many more styles could be made available, and one would not have to press SHIFT, ALT, or combinations of such keys while drawing.

Describe the solution you'd like

This would require an additional command-line option, for example something like this:

gromit-mpx --change-tool '"default"=PEN (size=6 color="green" arrowsize=1)'

Implementation

I have looked into the source code, and the implementation seems relatively straightforward. In fact, I have a working prototype that does exactly this, incl. passing command-line options to the running server (or is it called client?) and changing the tool. Currently, the pen details are hard-coded and not taken from the command line, but that would be easy enough.

The core of the parser in parse_config could be made a separate function that could be called with g_scanner processing a file (when reading the config) or a string (when parsing the new command line option).

What seems a bit awkward to me is that names need to be in quotes (this seems owed to the use of g_scanner), which means the command-line argument will have to be wrapped in single-quotes.

I could prepare a corresponding PR, but would like to hear about yours ideas. Would this be a useful option at all? What about the command-line syntax? Any implementation issues?

@pascal-niklaus
Copy link
Contributor Author

pascal-niklaus commented Feb 21, 2024

A working prototype can be found at https://github.com/pascal-niklaus/gromit-mpx/tree/devel_change_tool

It allows modifying tools like so:

gromit-mpx --deftool '"default"=PEN(color="#ff88ff" size=5 arrowsize=2)'
gromit-mpx --deftool '"default"[CONTROL]=PEN(color="#80ffff" size=5 arrowsize=2)'
gromit-mpx --deftool '"default"[CONTROL]="blue Pen" (size=5)'    # style based on definition in .config/gromit-mpx.cfg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants