Manages Hammerspoon in the user environment.
Table of Contents
Applying tool_hammerspoon
will make sure hammerspoon
is configured as specified.
The general configuration structure is in line with all other formulae from the tool suite, for details see :ref:`toolsuite`. An example pillar is provided, see :ref:`pillar.example`. Note that you do not need to specify everything by pillar. Often, it's much easier and less resource-heavy to use the parameters/<grain>/<value>.yaml
files for non-sensitive settings. The underlying logic is explained in :ref:`map.jinja`.
The following shows an example of tool_hammerspoon
per-user configuration. If provided by pillar, namespace it to tool_global:users
and/or tool_hammerspoon:users
. For the parameters
YAML file variant, it needs to be nested under a values
parent key. The YAML files are expected to be found in
salt://tool_hammerspoon/parameters/<grain>/<value>.yaml
orsalt://tool_global/parameters/<grain>/<value>.yaml
.
user:
# Force the usage of XDG directories for this user.
xdg: true
# Sync this user's config from a dotfiles repo.
# The available paths and their priority can be found in the
# rendered `config/sync.sls` file (currently, @TODO docs).
# Overview in descending priority:
# salt://dotconfig/<minion_id>/<user>/hammerspoon
# salt://dotconfig/<minion_id>/hammerspoon
# salt://dotconfig/<os_family>/<user>/hammerspoon
# salt://dotconfig/<os_family>/hammerspoon
# salt://dotconfig/default/<user>/hammerspoon
# salt://dotconfig/default/hammerspoon
dotconfig: # can be bool or mapping
file_mode: '0600' # default: keep destination or salt umask (new)
dir_mode: '0700' # default: 0700
clean: false # delete files in target. default: false
# Persist environment variables used by this formula for this
# user to this file (will be appended to a file relative to $HOME)
persistenv: '.config/zsh/zshenv'
# Add runcom hooks specific to this formula to this file
# for this user (will be appended to a file relative to $HOME)
rchook: '.config/zsh/zshrc'
# This user's configuration for this formula. Will be overridden by
# user-specific configuration in `tool_hammerspoon:users`.
# Set this to `false` to disable configuration for this user.
hammerspoon:
# Make sure some repos are cloned/absent to/from HS config dir.
spoons:
absent:
# Just the dir name as it would be produced by a `git clone`.
- stackline
# automatically update spoons with git.latest
update_auto: true
wanted:
# either git URL
- https://github.com/AdamWagner/stackline
# or git URL: branch mapping
- https://git.my.example/my/stackline: my
tool_hammerspoon:
# Specify an explicit version (works on most Linux distributions) or
# keep the packages updated to their latest version on subsequent runs
# by leaving version empty or setting it to 'latest'
# (again for Linux, brew does that anyways).
version: latest
# Default formula configuration for all users.
defaults:
spoons: default value for all users
tool_hammerspoon.config.sync
will recursively apply templates from
salt://dotconfig/<minion_id>/<user>/hammerspoon
salt://dotconfig/<minion_id>/hammerspoon
salt://dotconfig/<os_family>/<user>/hammerspoon
salt://dotconfig/<os_family>/hammerspoon
salt://dotconfig/default/<user>/hammerspoon
salt://dotconfig/default/hammerspoon
to the user's config dir for every user that has it enabled (see user.dotconfig
). The target folder will not be cleaned by default (ie files in the target that are absent from the user's dotconfig will stay).
The URL list above is in descending priority. This means user-specific configuration from wider scopes will be overridden by more system-specific general configuration.
The following states are found in this formula:
tool_hammerspoon
tool_hammerspoon.package
tool_hammerspoon.package.cli
tool_hammerspoon.xdg
tool_hammerspoon.config
tool_hammerspoon.spoons
tool_hammerspoon.clean
tool_hammerspoon.package.clean
tool_hammerspoon.package.cli.clean
tool_hammerspoon.xdg.clean
tool_hammerspoon.config.clean
tool_hammerspoon.spoons.clean
Meta-state.
Performs all operations described in this formula according to the specified configuration.
Installs the Hammerspoon package only.
Ensures Hammerspoon adheres to the XDG spec as best as possible for all managed users. Has a dependency on tool_hammerspoon.package.
Manages the Hammerspoon package configuration by
- recursively syncing from a dotfiles repo
Has a dependency on tool_hammerspoon.package.
Meta-state.
Undoes everything performed in the tool_hammerspoon
meta-state
in reverse order.
Removes Hammerspoon XDG compatibility crutches for all managed users.
Removes the configuration of the Hammerspoon package.
Commit message formatting is significant.
Please see How to contribute for more details.
pre-commit is configured for this formula, which you may optionally use to ease the steps involved in submitting your changes.
First install the pre-commit
package manager using the appropriate method, then run bin/install-hooks
and
now pre-commit
will run automatically on each git commit
.
$ bin/install-hooks
pre-commit installed at .git/hooks/pre-commit
pre-commit installed at .git/hooks/commit-msg
There is a script that semi-autodocuments available states: bin/slsdoc
.
If a .sls
file begins with a Jinja comment, it will dump that into the docs. It can be configured differently depending on the formula. See the script source code for details currently.
This means if you feel a state should be documented, make sure to write a comment explaining it.