XDG_CONFIG_HOME ?= $(HOME)/.config CONFIG_DIR := $(XDG_CONFIG_HOME)/tinted-theming/tinty BIN_DIR := $(HOME)/.local/bin HERDR_DIR := $(HOME)/.config/herdr HERDR_CONFIG := $(HERDR_DIR)/config.toml HERDR_MARKER := $(HERDR_DIR)/.tint-created-config LAUNCH_AGENT_DIR := $(HOME)/Library/LaunchAgents LAUNCH_AGENT_LABEL := dev.tinty.dark-notify LAUNCH_AGENT := $(LAUNCH_AGENT_DIR)/$(LAUNCH_AGENT_LABEL).plist DARK_NOTIFY_LOG := $(HOME)/Library/Logs/dark-notify.log CONFIG_MARKER := $(CONFIG_DIR)/.tint-installed-config STATE_MARKER := $(CONFIG_DIR)/.tint-installed-state .PHONY: install install-schemes uninstall install: default-state.toml config.toml @command -v tinty >/dev/null || { echo "tinty is required" >&2; exit 1; } @command -v dark-notify >/dev/null || { echo "dark-notify is required" >&2; exit 1; } mkdir -p "$(BIN_DIR)" "$(CONFIG_DIR)" "$(HERDR_DIR)" "$(LAUNCH_AGENT_DIR)" "$(dir $(DARK_NOTIFY_LOG))" go build -o "$(BIN_DIR)/tint" . @set -e; if [ "$(CURDIR)" != "$(CONFIG_DIR)" ]; then \ if [ -e "$(CONFIG_MARKER)" ] || [ ! -e "$(CONFIG_DIR)/config.toml" ]; then \ cp config.toml "$(CONFIG_DIR)/config.toml"; \ touch "$(CONFIG_MARKER)"; \ fi; \ fi; \ if [ ! -e "$(CONFIG_DIR)/state.toml" ]; then \ cp default-state.toml "$(CONFIG_DIR)/state.toml"; \ touch "$(STATE_MARKER)"; \ fi @if [ ! -e "$(HERDR_CONFIG)" ]; then \ touch "$(HERDR_CONFIG)" "$(HERDR_MARKER)"; \ fi XDG_CONFIG_HOME="$(XDG_CONFIG_HOME)" tinty sync $(MAKE) install-schemes @dark_notify="$$(command -v dark-notify)"; \ tinty_dir="$$(dirname "$$(command -v tinty)")"; \ printf '%s\n' \ '' \ '' \ '' \ '' \ ' Label' \ ' $(LAUNCH_AGENT_LABEL)' \ ' ProgramArguments' \ ' ' \ " $$dark_notify" \ ' -c' \ ' $(BIN_DIR)/tint' \ ' ' \ ' EnvironmentVariables' \ ' ' \ ' HOME' \ ' $(HOME)' \ ' PATH' \ " $$tinty_dir:/usr/bin:/bin:/usr/sbin:/sbin" \ ' XDG_CONFIG_HOME' \ ' $(XDG_CONFIG_HOME)' \ ' ' \ ' RunAtLoad' \ ' ' \ ' KeepAlive' \ ' ' \ ' StandardOutPath' \ ' $(DARK_NOTIFY_LOG)' \ ' StandardErrorPath' \ ' $(DARK_NOTIFY_LOG)' \ '' \ '' > "$(LAUNCH_AGENT)" plutil -lint "$(LAUNCH_AGENT)" @launchctl bootout "gui/$$(id -u)/$(LAUNCH_AGENT_LABEL)" 2>/dev/null || true launchctl bootstrap "gui/$$(id -u)" "$(LAUNCH_AGENT)" install-schemes: schemes/base16/pumpkin.yaml @set -e; \ data_dir="$$(XDG_CONFIG_HOME="$(XDG_CONFIG_HOME)" tinty config --data-dir-path)"; \ mkdir -p "$$data_dir/custom-schemes/base16"; \ cp schemes/base16/pumpkin.yaml "$$data_dir/custom-schemes/base16/pumpkin.yaml" uninstall: @launchctl bootout "gui/$$(id -u)/$(LAUNCH_AGENT_LABEL)" 2>/dev/null || true rm -f "$(BIN_DIR)/tint" "$(LAUNCH_AGENT)" "$(DARK_NOTIFY_LOG)" @if command -v tinty >/dev/null; then \ data_dir="$$(XDG_CONFIG_HOME="$(XDG_CONFIG_HOME)" tinty config --data-dir-path)" && \ rm -f "$$data_dir/custom-schemes/base16/pumpkin.yaml"; \ fi @if [ -e "$(STATE_MARKER)" ]; then \ rm -f "$(CONFIG_DIR)/state.toml" "$(STATE_MARKER)"; \ fi @if [ -e "$(CONFIG_MARKER)" ]; then \ rm -f "$(CONFIG_DIR)/config.toml" "$(CONFIG_MARKER)"; \ fi @if [ -e "$(HERDR_MARKER)" ]; then \ rm -f "$(HERDR_CONFIG)" "$(HERDR_MARKER)"; \ fi @rmdir "$(CONFIG_DIR)" "$(dir $(CONFIG_DIR))" "$(HERDR_DIR)" "$(BIN_DIR)" "$(LAUNCH_AGENT_DIR)" "$(dir $(DARK_NOTIFY_LOG))" "$(XDG_CONFIG_HOME)" "$(HOME)/.config" "$(HOME)/.local" 2>/dev/null || true