gui456wSERTDYF Posted February 6, 2023 Report Share Posted February 6, 2023 Are the hotkeys defined in a text file? Where is it located? (Ubuntu) Due to a problem with my computer my ctrl key does not work. Since this is a critical key for the game, I just want to map it to a different key. I can do this "by hand" by opening the game and changing this in the settings. However this is tedious. I am wondering if all the key bindings are defined in a text file where I can do this easier. Quote Link to comment Share on other sites More sharing options...
Mentula Posted February 6, 2023 Report Share Posted February 6, 2023 (edited) This question has already been asked and answered here: This page will help you find the correct datapath of the configuration files for your operating system: https://trac.wildfiregames.com/wiki/GameDataPaths Cheers Edited February 6, 2023 by Mentula 1 Quote Link to comment Share on other sites More sharing options...
gui456wSERTDYF Posted February 6, 2023 Author Report Share Posted February 6, 2023 (edited) I have the snap version. I cannot find the default.cfg and local.cfg files (I don't have them, I used `find ~ -name "default.cfg"`). I can find ~/snap/0ad/current/.config/0ad/config/user.cfg where I see the settings that I have changed (among those a few hotkeys I modified within the game). But I don't see all of them. I want to have them all in view so I can just do "find and replace". Edited February 6, 2023 by gui456wSERTDYF Quote Link to comment Share on other sites More sharing options...
Stan` Posted February 6, 2023 Report Share Posted February 6, 2023 See default.cfg in ps/trunk/binaries/data/config – Wildfire Games Quote Link to comment Share on other sites More sharing options...
gui456wSERTDYF Posted February 6, 2023 Author Report Share Posted February 6, 2023 @Stan` where am I supposed to find this file in my local installation? I mean, the one that actually 0AD reads when I run it. I want to customize it. Quote Link to comment Share on other sites More sharing options...
Stan` Posted February 6, 2023 Report Share Posted February 6, 2023 56 minutes ago, gui456wSERTDYF said: @Stan` where am I supposed to find this file in my local installation? I mean, the one that actually 0AD reads when I run it. I want to customize it. You're not supposed to customize it. But it should be in the same folder architecture as public.zip Quote Link to comment Share on other sites More sharing options...
gui456wSERTDYF Posted February 7, 2023 Author Report Share Posted February 7, 2023 But how should I proceed to replace e.g. ctrl with some other key? Of course manually within the game interface is an option, but very tedious and prone to mistakes. Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted February 7, 2023 Report Share Posted February 7, 2023 4 hours ago, gui456wSERTDYF said: But how should I proceed to replace e.g. ctrl with some other key? Of course manually within the game interface is an option, but very tedious and prone to mistakes. It shouldn't be all that tedious. I have done a lot of hotkey switching recently and it worked out well. You can just choose one unused key (I chose super, which is command on mac). Alternatively you could boot something like "follow" off of f so it is readily accessible to your left hand. Quote Link to comment Share on other sites More sharing options...
gui456wSERTDYF Posted February 8, 2023 Author Report Share Posted February 8, 2023 18 hours ago, real_tabasco_sauce said: It shouldn't be all that tedious. I have done a lot of hotkey switching recently and it worked out well. You can just choose one unused key (I chose super, which is command on mac). Alternatively you could boot something like "follow" off of f so it is readily accessible to your left hand. But you go manually one by one changing it in the settings? Or is there a mass hotkey editor? Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted February 8, 2023 Report Share Posted February 8, 2023 yeah I did it manually in game, but you could also do it manually in the user.cfg or maybe local.cfg. If you see hotkeys set in default.cfg that are not in user.cfg or ur local.cfg then you can add the lines to those file with new values. Quote Link to comment Share on other sites More sharing options...
Mentula Posted February 8, 2023 Report Share Posted February 8, 2023 I hope this post can clarify things a bit more. There are at least three options to change hotkeys. Option A Open 0 A.D., then open the Settings > Hotkeys menu. Change hotkeys from there. Note: @gui456wSERTDYF I know you are already aware of this solution, but I report it for completeness. This solution can be ok for replacing few hotkeys, but not suitable for changing many hotkeys. For example, this is not ideal for @gui456wSERTDYF's issue (replacing "Ctrl" everywhere). Option B Look at the default.cfg file present on your computer: this file should look like this. Each line identifies a configuration option. Just to make one concrete example, the default hotkey for attackmove can be found under the [hotkey.session] section in the default.cfg file: [hotkey.session] attackmove = Ctrl ; Modifier to attackmove when clicking on a point I you wish to rebind attackmove, say for instance to CapsLock, add this line to your user.cfg file: hotkey.session.attackmove = "CapsLock" Option C (recommended) Very similar to Option B. Following the above example, if you want to rebind attackmove to CapsLock (again, as an example), add these lines to your local.cfg file: [hotkey.session] attackmove = CapsLock ; Modifier to attackmove when clicking on a point The local.cfg file lies in the same folder as the user.cfg file; it possibly doesn't exists: if so, create it. The local.cfg file has the same structure of the default.cfg file. In principle, you can copy-paste everything you want from default.cfg into local.cfg and tweak the values at your own needs. Note: this solution is probably the one @gui456wSERTDYF is looking for. You can copy-paste all the default.cfg content that includes "Ctrl" into local.cfg and replace the "Ctrl" occurrencies with the key you like. Remember to include the section names (in the above example, the section name is [hotkey.session]). Option D (not 0 A.D.-related but OS-related) @gui456wSERTDYF if your Ctrl key is not working... have you considered assigning Ctrl to a different key system-wide? In many operating systems (and certainly in the GNU/Linux ones) you can assign Ctrl to other keys, for example to CapsLock. 1 Quote Link to comment Share on other sites More sharing options...
gui456wSERTDYF Posted February 11, 2023 Author Report Share Posted February 11, 2023 Thanks @Mentula, your option C is indeed the one I am looking for. I have found two occurrences of default.cfg which are here: ``` /snap/0ad/592/binaries/data/config/default.cfg /usr/share/games/0ad/config/default.cfg ``` Where should I place the local.cfg file? Next to one of these? Somewhere in my home directory? Quote Link to comment Share on other sites More sharing options...
Mentula Posted February 11, 2023 Report Share Posted February 11, 2023 The local.cfg file must be placed in the same folder as the user.cfg file. Therefore, look for user.cfg in your system. On a typical GNU/Linux installation, the user.cfg file is in ~/.config/0ad/config, but since yours is a snap installation, I have no clue where to find it. I'm sure you will easily find it with a file search. Surely though, the folder in which user.cfg is placed is not the same of default.cfg. Remember that default.cfg is not supposed to be changed. You will only use it to look at all the possible configurable options, and copy-paste from it to your local.cfg, but don't modify it. Quote Link to comment Share on other sites More sharing options...
Ceres Posted February 12, 2023 Report Share Posted February 12, 2023 @Mentula Great explanation - thank you! Have you thought about adding it to the Wiki? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.