-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: build hyprcursor with svgs (again) (#55)
* feat: build hyprcursor with svgs as mentioned in #53 (comment). Effectively rewrite the hyprcursor build system to be data driven, reflecting the other formats. As a result dependency on `hyprcursor-util` & `xcur2png` is gone. * scripts: remove hyprcursor specific commands #55 (comment) * fix: properly calculate hyprcursor hotspot * chore: cleanup removed unused items fixed indents * feat: generate manifest.hl from a template
- Loading branch information
Showing
57 changed files
with
147 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
BIN_DIR="$(dirname "${BASH_SOURCE[0]}")" | ||
SRC_DIR="src" | ||
HL_DIR="$3" | ||
BUILD_DIR="$2" | ||
RAWSVG_DIR="$1" | ||
ALIASES="$SRC_DIR/cursorList" | ||
|
||
NOMINAL_SIZE=24 | ||
REAL_SIZE=32 | ||
FRAME_TIME=30 | ||
SCALES="50 75 100 125 150 175 200 225 250 275 300" | ||
|
||
# Make folders | ||
for scale in $SCALES; do | ||
mkdir -p "$BUILD_DIR/x$scale" | ||
done | ||
mkdir -p "$BUILD_DIR/config" | ||
|
||
# Generate pixmaps | ||
genPixmaps="" | ||
for RAWSVG in ${RAWSVG_DIR}/*.svg; do | ||
BASENAME=${RAWSVG##*/} | ||
BASENAME=${BASENAME%.*} | ||
genPixmaps+="file-open:${RAWSVG};" | ||
|
||
for scale in $SCALES; do | ||
DIR="$BUILD_DIR/x${scale}" | ||
if [[ "${DIR}/${BASENAME}.png" -ot ${RAWSVG} ]]; then | ||
genPixmaps+=" export-width:$((${REAL_SIZE} * scale / 100)); export-height:$((${REAL_SIZE} * scale / 100)); export-filename:${DIR}/${BASENAME}.png; export-do;" | ||
fi | ||
done | ||
genPixmaps+=" file-close; " | ||
|
||
done | ||
|
||
inkscape --shell <<<${genPixmaps} &>/dev/null | ||
|
||
# Generate cursor theme | ||
OUTPUT=$4 | ||
rm -rf "$OUTPUT" | ||
mkdir -p "$OUTPUT/cursors" | ||
mkdir -p "$OUTPUT/cursors_scalable" | ||
mkdir -p "$HL_DIR" | ||
$BIN_DIR/generate-metadata ${RAWSVG_DIR} "$BUILD_DIR" "$OUTPUT/cursors" "$OUTPUT/cursors_scalable" "$HL_DIR" ${NOMINAL_SIZE} ${REAL_SIZE} ${FRAME_TIME} ${SCALES} | ||
|
||
# Generate shortcuts | ||
while read ALIAS; do | ||
FROM=${ALIAS% *} | ||
TO=${ALIAS#* } | ||
|
||
if [[ -e "$OUTPUT/cursors/$FROM" ]]; then | ||
continue | ||
fi | ||
|
||
ln -s "$TO" "$OUTPUT/cursors/$FROM" | ||
done <$ALIASES | ||
|
||
while read ALIAS; do | ||
FROM=${ALIAS% *} | ||
TO=${ALIAS#* } | ||
|
||
if [[ -e "$OUTPUT/cursors_scalable/$FROM" ]]; then | ||
continue | ||
fi | ||
|
||
ln -s "$TO" "$OUTPUT/cursors_scalable/$FROM" | ||
done <$ALIASES | ||
|
||
while read ALIAS; do | ||
FROM=${ALIAS% *} | ||
TO=${ALIAS#* } | ||
|
||
if [[ -e "$HL_DIR/$FROM" ]]; then | ||
continue | ||
fi | ||
|
||
if [ -f "$HL_DIR/$TO/meta.hl" ]; then # need to ensure $TO is not a mapping itself | ||
echo -ne "\ndefine_override = $FROM" >>$HL_DIR/$TO/meta.hl | ||
else | ||
grep=$(grep -m 1 "^$TO " $ALIASES) | ||
TO=${grep#* } | ||
echo -ne "\ndefine_override = $FROM" >>$HL_DIR/$TO/meta.hl | ||
fi | ||
done <$ALIASES | ||
|
||
#zip up hyprcursor | ||
mkdir -p "$OUTPUT/hyprcursors" | ||
for dir in $HL_DIR/*; do | ||
if [ -d "$dir" ]; then | ||
dir_name=$(basename "$dir") | ||
zip -qr "$OUTPUT/hyprcursors/$dir_name.hlc" -j "$dir/" | ||
fi | ||
done |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,3 @@ for dir in */; do | |
zip -ry "../releases/$theme_name" "$theme_name" | ||
done | ||
cd .. | ||
|
Oops, something went wrong.