all repos — dot @ master

Shell, editor and terminal configuration, and the tools that go with them

link/hammerspoon.sh (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
#!/bin/bash

# Hammerspoon config. Dry run by default; pass `yes` to apply.

set -euo pipefail

# shellcheck source-path=SCRIPTDIR
# shellcheck source=lib.sh
source "$(dirname "$0")/lib.sh" "$@"

link "$config_dir/hammerspoon/init.lua" "$xdg_config_dir/hammerspoon/init.lua"
# The helpers init.lua and a machine's own local.lua both require. Linked as its
# own file, not the directory: that directory is where local.lua lives.
link "$config_dir/hammerspoon/dotlib.lua" "$xdg_config_dir/hammerspoon/dotlib.lua"

if [[ "$(uname)" == "Darwin" ]]
then
  if [[ -n "${is_dry_run}" ]]
  then
    echo "Will set: "
    echo "defaults write org.hammerspoon.Hammerspoon MJConfigFile \"~/.config/hammerspoon/init.lua\""
  else
    defaults write org.hammerspoon.Hammerspoon MJConfigFile "$HOME/.config/hammerspoon/init.lua"
  fi
fi