-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feature: Multiple Kanata instances with unique configurations #10
Comments
Sure, this sounds like a useful feature. I'm not against making backwards incompatible changes to config.toml, we can even flip the config completely, as long as the result is a substantial improvement. While changing config format, #11 should also be taken into account, so breaking changes don't need to be done twice. But if a few iterations would be needed, I'm ok with it too. |
Implementing this is going to require major changes in both config and tray UI, so I'd like to handle it myself. |
A preview of a new config file format: https://gist.github.com/rszyma/dea3de8a6013070bba9cfeabf24e1fce |
and an example config: "$schema" = "https://gist.githubusercontent.com/rszyma/dea3de8a6013070bba9cfeabf24e1fce/raw"
[general]
allow_running_multiple_presets_concurrently = true
[defaults]
exe = "" # Kanata executable path. If empty/omitted, system PATH is searched.
tcp_port = 5829 # [optional] Default TCP port to use. Optional. Default is 5829 (it's an arbitrary number)
[defaults.layer_icons]
layer1 = "icon.ico"
layer2 = "qwerty.ico"
# Presets can be minimal just like the one below.
[presets.my-default-config]
autorun = true
# A preset can also be configured extensively:
[presets.'My config 2']
autorun = true
exe = "" # [optional] kanata executable override. If empty, the default kanata executable is used.
cfg = "" # [optional] `--cfg` argument passed to kanata
tcp_port = 5829 # Must be set for each preset if `allow_running_multiple_configurations` is set to `true`, otherwise optional.
extra_args = "--nodelay --debug" |
naming change suggestions welcome |
Cool stuff! A few thoughts:
|
Ok, I think my confusion mostly comes down to lack of familiarity with TOML. To me, [defaults]
exe = "" # Kanata executable path. If empty/omitted, system PATH is searched.
tcp_port = 5829 # [optional] Default TCP port to use. Optional. Default is 5829 (it's an arbitrary number)
[defaults.layer_icons]
layer1 = "icon.ico"
layer2 = "qwerty.ico" would be clearer as [defaults]
exe = "" # Kanata executable path. If empty/omitted, system PATH is searched.
tcp_port = 5829 # [optional] Default TCP port to use. Optional. Default is 5829 (it's an arbitrary number)
layer_icons = {
layer1 = "icon.ico"
layer2 = "qwerty.ico"
} but I now realize that's not valid TOML. Not to mention the fact that how the example is presented has little to do with the actual config file specification. That said, if this is to eventually integrate other utilities, what about organizing the config in terms of application? I've edited your example below with the following changes:
"$schema" = "https://gist.githubusercontent.com/rszyma/dea3de8a6013070bba9cfeabf24e1fce/raw"
[kanata_tray]
allow_running_multiple_presets_concurrently = true
[kanata]
path = "" # Kanata executable path. If empty/omitted, system PATH is searched.
tcp_port = 5829 # [optional] Default TCP port to use. Optional. Default is 5829 (it's an arbitrary number)
[kanata.layer_icons]
layer1 = "icon.ico"
layer2 = "qwerty.ico"
# Presets can be minimal just like the one below.
[presets.my-default-config]
autorun = true
# Presumably this one would use 5829?
# A preset can also be configured extensively:
[presets.'My config 2']
autorun = true
kanata.path = "" # [optional] kanata executable override. If empty, the default kanata executable is used.
kanata.config_file = "config.kbd" # [optional] `--cfg` argument passed to kanata
kanata.tcp_port = 5830 # Must be set for each preset if `allow_running_multiple_configurations` is set to `true`, otherwise optional.
kanata.extra_args = "--nodelay --debug"
kanata.layer_icons = {layer1 = "icon_2.ico", layer2 = "qwerty_2.ico"}
[presets.'another config']
autorun = false
kanata = {path = "./kanata_wintercept.exe", tcp_port = 5831} To me, it makes more sense that [presets.'My config 2']
autorun = true
kanata.path = "" # [optional] kanata executable override. If empty, the default kanata executable is used.
kanata.config_file = "config.kbd" # [optional] `--cfg` argument passed to kanata
kanata.tcp_port = 5830 # Must be set for each preset if `allow_running_multiple_configurations` is set to `true`, otherwise optional.
kanata.extra_args = "--nodelay --debug"
kanata.layer_icons = {layer1 = "icon_2.ico", layer2 = "qwerty_2.ico"}
# Additions below
kanata_helper_daemon.path = "./kanata_helper_daemon.exe"
kanata_helper_daemon.args = "--config-file=./config.kbd --port=5830" It's a little clunky having to repeat the config file path and the port number in the above example, but I can't think of a generalizable way to avoid that. But then again, the parser having to know what to do with the
On the other end of the spectrum, things could be tuned to integrate tightly with related programs like below. [presets.'My config 2']
autorun = true
config_file = "config.kbd" # [optional] `--cfg` argument passed to kanata
tcp_port = 5830 # Must be set for each preset if `allow_running_multiple_configurations` is set to `true`, otherwise optional.
kanata.path = "" # [optional] kanata executable override. If empty, the default kanata executable is used.
kanata.extra_args = "--nodelay --debug"
kanata.layer_icons = {layer1 = "icon_2.ico", layer2 = "qwerty_2.ico"}
# Additions below
kanata_helper_daemon.path = "./kanata_helper_daemon.exe"
# --config-file and --port args automatically filled in by config_file and tcp_port args above Sorry to ramble, but I hope my thoughts help. I suppose it just depends how much you want to manually integrate kanata_tray with other projects. If it were me I think I'd be taking the easy approach with the (btw, if you type "toml" after the opening three backticks of your code block you'll get syntax highlighting like above) |
Agree. The field names don't need to be that short. Updated config schema: https://gist.github.com/rszyma/dea3de8a6013070bba9cfeabf24e1fce/revisions |
Yes, thank you, it's helpful to see another point of view. 99% I'm not going to be directly integrating other tools with kanata-tray. And as your suggestion I would rather add support for it adding a field like |
I disagree. The way I see it is that group names for fields should be describing what what kind of settings are contained in the group. Looking at group |
I use kanata_wintercept to independently remap two devices. This allows me to map my macropad buttons to a-z for convenience while still being able to use my keyboard, but it requires me to run two separate Kanata instances.
I would love to just be able to run kanata-tray and have both instances spawn. I realize this would require some substantial change to the config file. Perhaps something of the following would be possible, where each file has its own unique configuration overrides defined in an inline table; any values not specified therein are replaced by the global/default values. I don't see a reason this couldn't coexist with the existing format.
Or maybe a format like the following would be better for simpler compatibility with the current format:
Disclaimer: I briefly read through the TOML spec but am otherwise unfamiliar with the format.
The text was updated successfully, but these errors were encountered: