logo

ultrasharp-cursor-theme

Precision and speed oriented cursor theme
commit: b39e1b91176ec04d6e47df714458e9084d753e7b
parent 912253f42564aa6fadb14fa1f56a67aabd3ebb99
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 18 Oct 2023 21:29:25 +0200

Move from Makefile to configure+build.ninja

Diffstat:

DMakefile25-------------------------
MREADME.md14+++++++++++---
Aconfigure130+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dcursors.mk88-------------------------------------------------------------------------------
Dcursors.sh44--------------------------------------------
5 files changed, 141 insertions(+), 160 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,25 +0,0 @@ -.SUFFIXES: -NAME = ultrasharp - -PREFIX ?= /usr -DATADIR ?= $(PREFIX)/share -ICONDIR ?= $(DATADIR)/icons -THEMEDIR = $(ICONDIR)/$(NAME) - -all: cursors.mk cursors/text cursors/arrow cursors/pointer cursors/vertical-text - -include cursors.mk - -cursors.mk: cursors.sh - ./$< > $@ - @echo "cursors.mk: Updated, you will probably need to re-run" - -.PHONY: clean -clean: - rm -f ${CURSORS} - -.PHONY: install -install: all - mkdir -p $(DESTDIR)$(THEMEDIR)/ - cp -r cursors $(DESTDIR)$(THEMEDIR)/ - cp index.theme $(DESTDIR)$(THEMEDIR)/ diff --git a/README.md b/README.md @@ -2,15 +2,23 @@ This is a precision and speed oriented cursor theme, the hotspot is known, contrast is optimised, pixels are perfect. Roughly the opposite of pastel butter-knife looking cursor themes. +## Specifications +- [XDG cursor-spec](https://www.freedesktop.org/wiki/Specifications/cursor-spec/) + ## Dependencies -- POSIX environment (including make) +- ninja / samurai +- POSIX Shell +- [quoter](https://github.com/vaeth/quoter/) - [xcursorgen](https://gitlab.freedesktop.org/xorg/app/xcursorgen) ## Supported environments - XOrg (deprecated) - wlroots-based compositors -## Installation -- `make install` +## Building +- `./configure` - You can use any of `PREFIX`, `DATADIR`, `ICONDIR` to change the path. + +## Installing +- `ninja install` - For packaging, `DESTDIR` is supported diff --git a/configure b/configure @@ -0,0 +1,130 @@ +#!/bin/sh +# SPDX-FileCopyrightText: 2023 Haelwenn (lanodan) Monnier <contact+ultrasharp@hacktivis.me> +# SPDX-License-Identifier: BSD-3-Clause + +set -e + +usage() { +cat <<'END' +Usage: [variables] configure [variables] + +Variables: + PREFIX=DIR + DATADIR=DIR + ICONDIR=DIR + + QUOTER=BIN + XCURSORGEN=BIN + +Variables are set in the following order: Default, Environment, Arguments + +Dependencies: See README.md +END +} + +is_ok() { + status="$?" + + if test $status -eq 0; then + printf ' OK\n' + else + printf ' FAIL\n' + fi + + return $status +} + +required() { + is_ok || exit 1 +} + +# defaults +PREFIX="${PREFIX:-/usr/local}" +XCURSORGEN="${XCURSORGEN:-xcursorgen}" +QUOTER="${QUOTER:-quoter}" + +printf 'Checking %s command existance ...' "${QUOTER}" +command -v "${QUOTER}" >/dev/null ; required + +arg0="$0" +args="$("${QUOTER}" -- "$@" | sed 's;\$;$$;')" + + +# Also allow variables through arguments +for i; do + case "$i" in + -h|--help) + usage + exit 1 + ;; + -*) + printf "Unknown argument ā€˜%sā€™\n" "${i}" + usage + exit 1 + ;; + *=*) + # shellcheck disable=SC2163 + export "$i" + shift + ;; + *) + printf "Unknown argument ā€˜%sā€™\n" "${i}" + usage + exit 1 + ;; + esac +done + +# Fallback definitions for dirs, based on $PREFIX +DATADIR=${DATADIR:-${PREFIX}/share} +ICONDIR=${ICONDIR:-${DATADIR}/icons} + +## System checks +printf 'Checking %s command existance ...' "${XCURSORGEN}" +command -v "${XCURSORGEN}" >/dev/null ; required + +CURSORS=' +text +arrow +pointer +vertical-text +' + +NAME=ultrasharp + +printf 'Writing to build.ninja ...' +( +cat <<EOF +# Autogenerated by $arg0 $args + +THEMEDIR = ${ICONDIR}/${NAME} +XCURSORGEN = ${XCURSORGEN} + +rule gen_config + command = ${arg0} ${args} + generator = 1 + +build build.ninja: gen_config configure + +rule cursorgen + command = \$XCURSORGEN \$in \$out + +rule install + command = mkdir -p \${DESTDIR}\${THEMEDIR}/ && cp -r cursors \${DESTDIR}\${THEMEDIR}/ && cp index.theme \${DESTDIR}\${THEMEDIR}/ + +build install: install | cursors + +EOF + +printf 'build all: phony' +printf ' cursors/%s' ${CURSORS} +printf '\n\n' +printf 'default all\n' + +for cur in ${CURSORS}; do + printf 'build cursors/%s: cursorgen %s.cfg | %s.png\n' $cur $cur $cur +done +) >|build.ninja +is_ok + +printf '\nDone, you can now run ninja or samu\n' diff --git a/cursors.mk b/cursors.mk @@ -1,88 +0,0 @@ -CURSORS = cursors/text cursors/pointer cursors/help cursors/progress cursors/wait cursors/copy cursors/alias cursors/no-drop cursors/not-allowed cursors/all-scroll cursors/row-resize cursors/col-resize cursors/e-resize cursors/ne-resize cursors/nw-resize cursors/n-resize cursors/se-resize cursors/sw-resize cursors/s-resize cursors/w-resize cursors/vertical-text cursors/crosshair cursors/cell cursors/context-menu cursors/ew-resize cursors/ns-resize cursors/nesw-resize cursors/nwse-resize - -cursors: ${CURSORS} - -cursors/text: text.png text.cfg - xcursorgen text.cfg $@ - -cursors/pointer: pointer.png pointer.cfg - xcursorgen pointer.cfg $@ - -cursors/help: help.png help.cfg - xcursorgen help.cfg $@ - -cursors/progress: progress.png progress.cfg - xcursorgen progress.cfg $@ - -cursors/wait: wait.png wait.cfg - xcursorgen wait.cfg $@ - -cursors/copy: copy.png copy.cfg - xcursorgen copy.cfg $@ - -cursors/alias: alias.png alias.cfg - xcursorgen alias.cfg $@ - -cursors/no-drop: no-drop.png no-drop.cfg - xcursorgen no-drop.cfg $@ - -cursors/not-allowed: not-allowed.png not-allowed.cfg - xcursorgen not-allowed.cfg $@ - -cursors/all-scroll: all-scroll.png all-scroll.cfg - xcursorgen all-scroll.cfg $@ - -cursors/row-resize: row-resize.png row-resize.cfg - xcursorgen row-resize.cfg $@ - -cursors/col-resize: col-resize.png col-resize.cfg - xcursorgen col-resize.cfg $@ - -cursors/e-resize: e-resize.png e-resize.cfg - xcursorgen e-resize.cfg $@ - -cursors/ne-resize: ne-resize.png ne-resize.cfg - xcursorgen ne-resize.cfg $@ - -cursors/nw-resize: nw-resize.png nw-resize.cfg - xcursorgen nw-resize.cfg $@ - -cursors/n-resize: n-resize.png n-resize.cfg - xcursorgen n-resize.cfg $@ - -cursors/se-resize: se-resize.png se-resize.cfg - xcursorgen se-resize.cfg $@ - -cursors/sw-resize: sw-resize.png sw-resize.cfg - xcursorgen sw-resize.cfg $@ - -cursors/s-resize: s-resize.png s-resize.cfg - xcursorgen s-resize.cfg $@ - -cursors/w-resize: w-resize.png w-resize.cfg - xcursorgen w-resize.cfg $@ - -cursors/vertical-text: vertical-text.png vertical-text.cfg - xcursorgen vertical-text.cfg $@ - -cursors/crosshair: crosshair.png crosshair.cfg - xcursorgen crosshair.cfg $@ - -cursors/cell: cell.png cell.cfg - xcursorgen cell.cfg $@ - -cursors/context-menu: context-menu.png context-menu.cfg - xcursorgen context-menu.cfg $@ - -cursors/ew-resize: ew-resize.png ew-resize.cfg - xcursorgen ew-resize.cfg $@ - -cursors/ns-resize: ns-resize.png ns-resize.cfg - xcursorgen ns-resize.cfg $@ - -cursors/nesw-resize: nesw-resize.png nesw-resize.cfg - xcursorgen nesw-resize.cfg $@ - -cursors/nwse-resize: nwse-resize.png nwse-resize.cfg - xcursorgen nwse-resize.cfg $@ - diff --git a/cursors.sh b/cursors.sh @@ -1,44 +0,0 @@ -#!/bin/sh -CURSORS=' -text -pointer -help -progress -wait -copy -alias -no-drop -not-allowed -all-scroll -row-resize -col-resize -e-resize -ne-resize -nw-resize -n-resize -se-resize -sw-resize -s-resize -w-resize -vertical-text -crosshair -cell -context-menu -ew-resize -ns-resize -nesw-resize -nwse-resize -' - -echo -n "CURSORS =" -printf ' cursors/%s' ${CURSORS} -printf '\n\n' - -printf 'cursors: ${CURSORS}\n\n' - -for cursor in ${CURSORS} -do - echo "cursors/${cursor}: ${cursor}.png ${cursor}.cfg" - echo " xcursorgen ${cursor}.cfg \$@" - echo "" -done