Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sevmeyer committed May 21, 2021
0 parents commit 93892a2
Show file tree
Hide file tree
Showing 66 changed files with 1,253 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
tmp/
*.zip
121 changes: 121 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
Creative Commons Legal Code

CC0 1.0 Universal

CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.

Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").

Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.

For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:

i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.

4. Limitations and Disclaimers.

a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Mocu
====

![Preview](mocu.png)

A modest xcursor theme, inspired by [DMZ] and [cz-Viator].

Available in white and black. Right and left-handed.
Size 24, 36, 48, 60, 72, 96. Distributed under the [CC0].

[DMZ]: https://www.gnome-look.org/p/999970/
[cz-Viator]: https://github.com/charakterziffer/cursor-toolbox/
[CC0]: https://creativecommons.org/publicdomain/zero/1.0


Make
----

The themes can be generated with the make script:

./make.sh

Dependencies:

- Common bash, sed, grep, etc.
- rsvg-convert
- xmlstarlet
- xcursorgen


Customization
-------------

The theme settings are stored in `src/themes.txt`.


### Colors

The svg files use placeholder colors, which are replaced
with the specific theme colors before rendering.

#0a0b0c = shadow
#1a1b1c = stroke
#fafbfc = fill


### Hotspot

Each svg source file must contain a `<circle>` element with `id="hot"`.
The center of the circle represents the hotspot.


### Handedness

For a given handedness, each occurence of `class="HAND(SCALE,MOVE)"` is
replaced with `transform="translate(MOVE)scale(SCALE,1)"` before rendering.


### Animations

To animate a cursor, the svg source file can be accompanied
by a `.txt` file. Each line in that file represents a frame,
in the format `DELAY ATTRIBUTE`. Each occurence of `class="anim"`
is replaced with `ATTRIBUTE` before rendering the respective frame.
64 changes: 64 additions & 0 deletions make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
set -e

srcDir="src"
outDir="dist"
tmpDir="tmp"

while read theme fill stroke shadow hand; do
cursorDir="$outDir/$theme/cursors"
index="$outDir/$theme/index.theme"

# Prepare directories
rm --recursive --force "$tmpDir"
rm --recursive --force "$cursorDir"
mkdir --parents "$tmpDir"
mkdir --parents "$cursorDir"
printf "[Icon Theme]\nName=${theme//-/ }\nComment=A modest cursor theme\n" > "$index"

while read name; do
svg="$srcDir/svg/$name.svg"
txt="$srcDir/svg/$name.txt"
cfg="$tmpDir/$name.cfg"
cursor="$cursorDir/$name"
printf "$cursor\n"

# Extract hotspot
IFS='(,)' read hotX hotY hotHand hotScale hotMove <<< $(\
xmlstarlet select --template --match '//_:circle[@id="hot"]' \
--value-of "concat(@cx,',',@cy,',',@class)" "$svg")

if [ "$hotHand" = "$hand" ]; then
hotX=$(awk "BEGIN {print $hotX * $hotScale + $hotMove}")
fi

# Render png
for scale in 1 1.5 2 2.5 3 4; do
size=$(awk "BEGIN {print int($scale * 24 + 0.5)}")
x=$(awk "BEGIN {print int($scale * $hotX + 0.49)}")
y=$(awk "BEGIN {print int($scale * $hotY + 0.49)}")

while read frame delay attrib; do
png="$tmpDir/$name-$size-$frame.png"
printf "$size $x $y $png $delay\n" >> "$cfg"
sed -e "s|#fafbfc|$fill|g" \
-e "s|#1a1b1c|$stroke|g" \
-e "s|#0a0b0c|$shadow|g" \
-e "s|class=\"anim\"|$attrib|g" \
-e "s|class=\"$hand(\([-0-9]*\),\([-0-9]*\))\"|transform=\"translate(\2)scale(\1,1)\"|g" \
-e 's|id="hot"|display="none"|g' \
"$svg" | rsvg-convert --zoom "$scale" --output "$png"
done < <(cat --number "$txt" 2>/dev/null || printf '1\n')
done

# Generate cursor
xcursorgen "$cfg" "$cursor"

done < <(grep "^[0-9A-Za-z]" "$srcDir/names.txt")

# Add alternative names
while read alias target; do
ln --symbolic --force "$target" "$cursorDir/$alias"
done < <(grep "^[0-9A-Za-z]" "$srcDir/aliases.txt")

done < <(grep "^[0-9A-Za-z]" "$srcDir/themes.txt")
Binary file added mocu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
119 changes: 119 additions & 0 deletions src/aliases.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Alternative cursor names (duplicates are omitted)
# Format: ALIAS TARGET

# X11
# https://gitlab.freedesktop.org/xorg/data/cursors

arrow default
bottom_left_corner sw-resize
bottom_right_corner se-resize
bottom_side s-resize
cross crosshair
cross_reverse crosshair
double_arrow ns-resize
dot_box_mask dotbox
fleur move
hand1 pointer
hand2 pointer
left_ptr default
left_ptr_watch progress
left_side w-resize
pirate x-cursor
plus cell
question_arrow help
right_side e-resize
sb_down_arrow down-arrow
sb_h_double_arrow ew-resize
sb_left_arrow left-arrow
sb_right_arrow right-arrow
sb_up_arrow up-arrow
sb_v_double_arrow ns-resize
top_left_corner nw-resize
top_right_corner ne-resize
top_side n-resize
watch wait
X_cursor x-cursor
xterm text


# GTK
# https://gitlab.gnome.org/GNOME/gtk/-/blob/master/gdk/x11/gdkcursor-x11.c

bd_double_arrow nwse-resize
crossed_circle not-allowed
dnd-none grabbing
fd_double_arrow nesw-resize
hand pointer
move grabbing
h_double_arrow ew-resize
v_double_arrow ns-resize


# Qt
# https://doc.qt.io/qt-5/qcursor.html#a-note-for-x11-users

closedhand grabbing
dnd-move grabbing
forbidden not-allowed
ibeam text
link alias
openhand grab
pointing_hand pointer
size_all move
size_bdiag nesw-resize
size_fdiag nwse-resize
size_hor ew-resize
size_ver ns-resize
split_h col-resize
split_v row-resize
whats_this help


# Adwaita (GNOME) and Breeze (KDE)
# https://gitlab.gnome.org/GNOME/adwaita-icon-theme
# https://invent.kde.org/plasma/breeze

circle not-allowed
draft pencil
left_ptr_help help

3085a0e285430894940527032f8b26df alias
640fb0e74195791501fd1ed57b41487f alias
a2a266d0498c3104214a47bd64ab0fc8 alias
1081e37283d90000800003c07f3ef6bf copy
6407b0e94181790501fd1e167b474872 copy
b66166c04f8c3109214a4fbd64a50fc8 copy
028006030e0e7ebffc7f7070c0600140 ew-resize
14fef782d02440884392942c11205230 ew-resize
fcf21c00b30f7e3f83fe0dfd12e71cff grabbing
5c6cd98b3f3ebcb1f9c7f1c204630408 help
d9ce0ab605698f320427677b458ad60b help
4498f0e0c1937ffe01fd06f973665830 move
9081237383d90e509aa00f00170e968f move
fcf1c3c7cd4491d801f1e1c78f100000 nesw-resize
03b6e0fcb3499374a867c041f52298f0 not-allowed
00008160000006810000408080010102 ns-resize
2870a09082c103050810ffdffffe0204 ns-resize
c7088f0f3e6c8088236ef8e1e3e70000 nwse-resize
9d800788f1b08800ae810202380a0822 pointer
e29285e634086352946a0e7090d73106 pointer
00000000000000020006000e7e9ffc3f progress
3ecb610c1bf2410f44200f48c40d3599 progress


# Mozilla
# https://hg.mozilla.org/mozilla-central/file/tip/widget/gtk/nsGtkCursors.h
# https://hg.mozilla.org/mozilla-central/file/tip/widget/gtk/nsWindow.cpp

0876e1c15ff2fc01f906f1c363074c0f alias
08ffe1e65f80fcfdf9fff11263e74c48 context-menu
08ffe1cb5fe6fc01f906f1c063814ccf copy
5aca4d189052212118709018842178c0 grab
208530c400c041818281048008011002 grabbing
50585d75b494802d0151028115016902 nesw-resize
03b6e0fcb3499374a867d041f52298f0 not-allowed
38c5dff7c7b8962045400281044508d2 nwse-resize
08e8e1c95fe2fc01f976f1e063a24ccd progress
048008013003cff3c00c801001200000 vertical-text
f41c0e382c94c0958e07017e42b00462 zoom-in
f41c0e382c97c0938e07017e42800402 zoom-out
Loading

0 comments on commit 93892a2

Please sign in to comment.