i3keys
i3keys copied to clipboard
Add 'include' functionality
It would be very cool if this could handle 'include' statements in the config to pull in other config files with key definitions.
Include statements should work, do you have a case where they don't?
Note that environment variables like $HOME
will have to be written ${HOME}
in the config file or they won't expand.
My include lines look like this:
include includes/keys_workspaces
I'm just specifying the subfolder, not the full path. Is that why there's a problem?
It's a possibility. See if specifying the correct absolute path makes a difference (after reloading i3/sway config and restarting i3keys).
Just to make sure I understand correctly, your includes/keys_workspaces
works in i3/sway but the bindings therein are not detected by i3keys?
I did some quick tests, and relative includes seem to be working fine here, also from a subdirectory. Things that come to mind:
- a typo? sway does not complain about missing includes (don't know about i3)
- i3keys reads the configuration once at start, if it's changed while running it won't notice until restarted
- perhaps in some cases i3/sway and i3keys disagree about what a relative path is relative to?
By the way, is it i3 or sway you are running? It shouldn't make any difference, but just in case. (sway here)
I'm using i3, but yes, the keybindings work just fine but don't show up in i3keys. I'll try the absolute paths later today. As for your 'things that come to mind' ;-) the first two don't apply, but the 3rd one is certainly plausible. I don't mind putting absolute paths in my configs if needed. It doesn't matter to me. I love this program, btw! Thanks for it.
Interesting, I'll try look into it some more. If I manage to reproduce the problem, probably I can fix it too and PR. P.S. thank Rasmus, he wrote it. I'm just passing by.
I think I've found the problem. It seems the program only gets the path for sway and not i3 https://github.com/RasmusLindroth/i3keys/blob/99e368e4cbb4f82f4e9461c3fd43054add0c3c37/i3parse/parse.go#L241
So the fix should be quite easy, just create a function equal to helpers.GetSwayDefaultConfig()
and send the name of the window manager down to the parse function. I'll look into it later and test it, but in the meantime absolute paths should work :)
Cool. I'll await your fix and test it on my setup. I'm in no big hurry. ;-)
@macxcool Do you have sway installed on your computer? Because now that I look at the code it should be picking up i3 folders if you don't have it installed
Could you test this branch and see it it works?
https://github.com/RasmusLindroth/i3keys/tree/i3-include-test
cd /tmp
git clone https://github.com/RasmusLindroth/i3keys.git
cd i3keys
git checkout i3-include-test
go build
/tmp/i3keys web 8080
Yes. I do have sway installed, just for experimenting with. I run i3, normally, though.
I will test that this evening (i.e. in a couple of hours)
That works. I see all my configured bindings and my modes and everything! Cool.