Configuring Slate

January 31, 2016 · View on GitHub

Files

Traditional Configuration

Slate is configured using a .slate file in the current user's home directory. Configuration is loaded upon running Slate. You can also re-load the config using the Relaunch and Load Config menu option on the status menu. (Use this at your own risk. It is better to simply restart Slate.)

JavaScript Configuration

NEW: You may now use a .slate.js file to configure slate using JavaScript. This allows for much more complex and dynamic configurations than the normal slate configuration style below. You can check out the documentation for this here.

Default Config File

Note: If no .slate or .slate.js file exists in the current user's home directory, the default config file will be used.

Traditional Configuration Format

Directives

Configuration is split into the following directives:

  • config for global configurations
  • alias to create alias variables
  • layout to configure layouts
  • default to default certain screen configurations to layouts
  • bind for key bindings
  • source to load configs from another file

Note: # is the comment character. Anything after a # will be ignored.

Expressions

Some directives allow parameters that can be expressions. The following strings will be replaced with the appropriate values when using expressions:

VariableDescription
screenOriginXtarget screen's top left x coordinate (should not be used in Window Hints configs)
screenOriginYtarget screen's top left y coordinate (should not be used in Window Hints configs)
screenSizeXtarget screen's width
screenSizeYtarget screen's height
windowTopLeftXwindow's current top left x coordinate (should not be used in Window Hints configs)
windowTopLeftYwindow's current top left y coordinate (should not be used in Window Hints configs)
windowSizeXwindow's width
windowSizeYwindow's height
newWindowSizeXwindow's new width (after resize, only usable in topLeftX and topLeftY, should not be used in configs)
newWindowSizeYwindow's new height (after resize, only usable in topLeftX and topLeftY, should not be used in configs)
windowHintsWidththe value of the windowHintsWidth config (only usable in windowHintsTopLeftX and windowHintsTopLeftY)
windowHintsHeightthe value of the windowHintsHeight config (only usable in windowHintsTopLeftX and dowHintsTopLeftY)

In addition to the variables above, expressions can be used with the following functions and operators:

Operator/FunctionExample
+1+12
-1-10
*2*24
/4/22
**3**29
sumsum({1,2,3})6
countcount({4,5,6})3
minmin({1,3,5})1
maxmax({1,3,5})5
averageaverage({1,2,3,4})2.5
medianmedian({1,2,3,10,15})3
stddevstddev({1,2,3,4,5})1.4142135623730951
sqrtsqrt(9)3.0
loglog(100)2.0
lnln(8)2.0794415416798357
expexp(2)7.3890560989306504 (same as e**parameter)
floorfloor(1.9)1.0
ceilingceiling(1.1)2.0
absabs(-1)1
trunctrunc(1.1123123123)1.0
randomrandom()0.20607629744336009 (random float between 0 and 1)
randomnrandomn(10)4 (random integer between 0 and parameter-1)

Note: When using expressions spaces are not allowed!

Example Config

You can check out an example config here.