feat: support user preview configuration and document UI

This commit is contained in:
2026-10-05 19:17:27 +05:30
parent ee6186ed0b
commit de8843471b
10 changed files with 210 additions and 80 deletions

View File

@@ -9,6 +9,8 @@ PREFIX ?= /usr
DESTDIR ?=
BINDIR := $(DESTDIR)$(PREFIX)/bin
CONFDIR := $(DESTDIR)/etc/$(PROJECT)
USER_CONFIG_HOME ?= $(if $(XDG_CONFIG_HOME),$(XDG_CONFIG_HOME),$(HOME)/.config)
USER_CONFDIR := $(USER_CONFIG_HOME)/$(PROJECT)
SYSTEMD_DIR := $(DESTDIR)/usr/lib/systemd/system
BUILD_DIR ?= build
DIST_DIR ?= dist
@@ -49,7 +51,7 @@ endif
.PHONY: all deps build release-build test check fmt lint doc audit docker-test \
integration-test pam-fixture-test system-e2e system-e2e-strict \
package release release-check version install uninstall clean run-preview \
package release release-check version install install-user uninstall clean run-preview \
legacy-build legacy-check enable update help
all: release-build ## Build the optimized release binary
@@ -147,6 +149,16 @@ install: build ## Install the binary, config, PAM policy, and systemd unit
@install -Dm644 extra/latchd.service '$(SYSTEMD_DIR)/$(PROJECT).service'
@install -d '$(CONFDIR)/wms' '$(CONFDIR)/wayland'
install-user: ## Copy the example config to the current user's config directory
@test -n '$(USER_CONFIG_HOME)' || { echo 'HOME or XDG_CONFIG_HOME is required'; exit 1; }
@install -d -m700 '$(USER_CONFDIR)'
@if [ -e '$(USER_CONFDIR)/config.toml' ]; then \
printf 'configuration at %s was preserved\n' '$(USER_CONFDIR)/config.toml'; \
else \
install -m600 extra/config.toml '$(USER_CONFDIR)/config.toml'; \
printf 'created %s\n' '$(USER_CONFDIR)/config.toml'; \
fi
uninstall: ## Remove files installed by make install
@rm -f '$(BINDIR)/$(BINARY)' '$(DESTDIR)/etc/pam.d/$(PROJECT)' '$(SYSTEMD_DIR)/$(PROJECT).service'
@printf '$(YELLOW)configuration at %s was preserved; remove it manually if no longer needed$(RESET)\n' '$(CONFDIR)'