Skip to content

How to use keybinds

boltgolt edited this page Dec 3, 2019 · 2 revisions

Starting from version 0.2.1, Boltobserv supports native OS keybinds. These keybinds can be used to trigger al kinds of radar settings or functions. They are generally defined in a file called keybinds.overwrite.json5 in the config directory.

This wiki page attempts to explain how to use these keybinds and how to create new ones.

The keybinds file

keybinds.json5 is a simple json(5) file that contains exactly 1 object. To create a portable file that overwrites the default one shipped with Boltobserv, duplicate it and rename it to keybinds.overwrite.json5.

Adding new keybinds is done by adding new keys to the object, where the object key itself is the key combination ("accelerator") and the value is either an command, or an array of commands:

{
	"ACCELERATOR": "COMMAND",
	"ACCELERATOR": ["COMMAND", "COMMAND"]
}

The accelerator string normally contains 1 or more keycodes that, when pressed simultaneously, will trigger the defined command. The command is executed immediately when the key combination is pressed, and commands in an array will be executed sequentially from left to right.

The simplest possible example of a keybind would be:

{
	"Capslock": "window.fullscreen->toggle"
}

Here pressing the Caps Lock key will fullscreen the radar if it was in windowed mode and vice versa.

A more complicated keybind could be:

{
	"Control+Alt+O": [
		"window.fullscreen->on", 
		"functions.sleep(5)", 
		"window.fullscreen->off"
	]
}

Defining an accelerator

A combination of keycodes (an "accelerator") is used to define what key combination should execute the command. This accelerator is defined as a string with 1 or more keycodes separated by a + character.

For example, to trigger the accelerator Control+Shift+P you would need to press the Ctrl, Shift and P keys simultaneously.

Click to show supported keycodes

  • Command (or Cmd for short)
  • Control (or Ctrl for short)
  • Alt
  • Option
  • AltGr
  • Shift
  • Super
  • 0 to 9
  • A to Z
  • F1 to F24
  • Punctuations like ~, !, @, #, $, etc.
  • Plus (don't use the + character as it's the separator)
  • Space
  • Tab
  • Capslock
  • Numlock
  • Scrolllock
  • Backspace
  • Delete
  • Insert
  • Return (or Enter as alias)
  • Up, Down, Left and Right
  • Home and End
  • PageUp and PageDown
  • Escape (or Esc for short)
  • VolumeUp, VolumeDown and VolumeMute
  • MediaNextTrack, MediaPreviousTrack, MediaStop and MediaPlayPause
  • PrintScreen
  • num0 to num9 (numpad number keys)
  • numdec (numpad decimal key)
  • numadd (numpad + key)
  • numsub (numpad - key)
  • nummult (numpad * key)
  • numdiv (numpad ÷ key)

Available commands

Commands come in 2 different types: "Actions" can only set a value to on or off, while "functions" allow specific code to be run once and can be passed arguments.

Actions

Actions are persistent boolean values that can either be on (true) or off (false). They can be used to change settings dynamically while the radar is running.

The value of an action can be set by appending either ->on or ->off to the end of an action name. It's also possible to use ->toggle to toggle the value on or off.

For example window.fullscreen->off or radar.autozoom->toggle

Click to show available actions

Action Description
window.fullscreen Set program window to full screen (non-browser)
window.mousePassthrough Set if mouse clicks register on the window below the radar
radar.autozoom Set automatic zoom

Functions

Functions are commands that are executed once. They do not have a value and can only be called directly.

To call these functions, add opening and closing parentheses after the function name. If you want to specify an argument, put it between the parentheses. This syntax is very similar to javascript.

For example functions.reload() or functions.sleep(10)

Click to show available functions

Function Argument Description
functions.reload N/A Reset all windows and browsers, useful if radar is stuck
functions.sleep Number Wait the specified amount of seconds before executing the next command
window.width Number Set the width of the window
window.height Number Set the height of the window
window.top Number Set how many pixels the window is positioned from the top of the screen
window.left Number Set how many pixels the window is positioned from the left of the screen