Jump to content

Where are the hotkeys defined?


gui456wSERTDYF
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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 by gui456wSERTDYF
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...