Closed qaxi closed 1 week ago
There is an example in readme
Edit: actually there's only example for defaults
In your case, this should work:
[presets.'QTZ-homerow/numeric/arrows']
kanata_config = '~/.config/kanata/kanata.kbd'
autorun = true
[presets.'QTZ-homerow/numeric/arrows'.layer_icons]
nomods = 'Ab.png'
Hmm layer_icons = {nomods = 'Ab.png'}
should work too. Is it the one that gives panic?
Hmm
layer_icons = {nomods = 'Ab.png'}
should work too. Is it the one that gives panic?
[presets.'QTZ-homerow/numeric/arrows'] layer_icons = { 'nomods'= 'Ab.png' }
and
[presets.'QTZ-homerow/numeric/arrows'] layer_icons = {nomods = 'Ab.png'}
throws
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5e1369]
goroutine 1 [running, locked to thread]:
github.com/rszyma/kanata-tray/app.ResolveIcons({0xc000020200?, 0xc0000147c0?}, 0xc000118370)
github.com/rszyma/kanata-tray/app/custom_icons.go:101 +0x489
main.mainImpl()
github.com/rszyma/kanata-tray/main.go:117 +0x5db
main.main()
github.com/rszyma/kanata-tray/main.go:42 +0x214
And more ...
This config
...
[defaults.layer_icons]
# qwertz = 'Ab.png'
# qwertz_nomods = 'Ab.png'
# homerow = 'HR.png'
# numbers = '12.png'
# arrows = 'arrow.png'
# navigation = 'arrow.png'
# mouse = 'mouse.png'
'*' = 'other.png'
[presets.'QTZ-homerow/numeric/arrows']
kanata_config = '~/.config/kanata/kanata.kbd'
autorun = true
#layer_icons = { nomods = 'Ab.png' }
# kanata_executable = ''
# tcp_port = 1234
[presets.'QTZ-homerow/numeric/arrows'.layer_icons]
qwertz = 'Ab.png'
qwertz_nomods = 'Ab.png'
homerow = 'HR.png'
numbers = '12.png'
arrows = 'arrow.png'
navigation = 'arrow.png'
mouse = 'mouse.png'
...
throws
2024-11-12T13:56:26.964707384+01:00 INFO kanata-tray config folder: /home/klima/.config/kanata-tray
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5e1369]
goroutine 1 [running, locked to thread]:
github.com/rszyma/kanata-tray/app.ResolveIcons({0xc000020200?, 0xc0000147c0?}, 0xc000118370)
github.com/rszyma/kanata-tray/app/custom_icons.go:101 +0x489
main.mainImpl()
github.com/rszyma/kanata-tray/main.go:117 +0x5db
main.main()
github.com/rszyma/kanata-tray/main.go:42 +0x214
And this is the strangest for me
...
[defaults.layer_icons]
# qwertz = 'Ab.png'
# qwertz_nomods = 'Ab.png'
# homerow = 'HR.png'
# numbers = '12.png'
# arrows = 'arrow.png'
# navigation = 'arrow.png'
# mouse = 'mouse.png'
'*' = 'other.png'
[presets.'QTZ-homerow/numeric/arrows']
kanata_config = '~/.config/kanata/kanata.kbd'
autorun = true
# !!!!!!!!!!!!!!!! this is the difference !!!!!!!!!!!!!!!!!!!!
layer_icons = { nomods = 'Ab.png' }
# !!!!!!!!!!!!!!!! this is the difference !!!!!!!!!!!!!!!!!!!!
# kanata_executable = ''
# tcp_port = 1234
[presets.'QTZ-homerow/numeric/arrows'.layer_icons]
qwertz = 'Ab.png'
qwertz_nomods = 'Ab.png'
homerow = 'HR.png'
numbers = '12.png'
arrows = 'arrow.png'
navigation = 'arrow.png'
mouse = 'mouse.png'
...
fails different way
$ kanata-tray-linux
2024-11-12T13:59:25.353507288+01:00 INFO kanata-tray config folder: /home/klima/.config/kanata-tray
2024-11-12T13:59:25.353679194+01:00 ERROR kanata-tray exited with an error: loading config failed: failed to parse config file '/home/klima/.config/kanata-tray/kanata-tray.toml': toml: key layer_icons should be a table, not a value
The examples that threw panics are correct configs, but somehow it was broken since ever. Now it's fixed in main.
The last example that errors with "key layer_icons should be a table, not a value" is just a bit imprecise error message from go-toml library part. The more correct would be if it said "conflicting/duplicate keys". You can read from toml spec that defining keys multiple times is an error, and you specified layer_icons 2 times (one in inline table and one in key/value pair). Toml spec is suprisingly quite quirky, I recomment you to take a look at spec - https://toml.io/en/v1.0.0.
Confirm, works by design.
Thank you.
Hi,
I have difficulty to understand the documentation how to set presets layers_icons
I tried this, does not work ... ` .... [presets.'QTZ-homerow/numeric/arrows'] kanata_config = '~/.config/kanata/kanata.kbd' autorun = true layer_icons = [ nomods = 'Ab.png' ]
kanata_executable = ''
.... `
The other variants I can imangine do not work too
layer_icons = {nomods = 'Ab.png'}
,layer_icons = { 'nomods': 'Ab.png' }
,layer_icons = { 'nomods'= 'Ab.png' }
... Some leads to "syntax error" without clue what to do, some leads topanic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5e1369]
It would be helpful to see an example in default configuration file (with at least two added icons ...)