Skip to content

Commit

Permalink
feat: Support multi-resolution for Windows Cursors
Browse files Browse the repository at this point in the history
  • Loading branch information
ful1e5 committed Apr 26, 2024
1 parent ff9aaa7 commit c684a72
Show file tree
Hide file tree
Showing 7 changed files with 586 additions and 188 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ Open source macOS Cursors for `Windows` and `Linux` with _HiDPI Support_ .

### Windows Cursor Size:

- <kbd>16x16</kbd> - Small
- <kbd>24x24</kbd> - Regular
- <kbd>32x32</kbd> - Large
- <kbd>48x48</kbd> - Extra Large
| size | Regular (× ²⁄₃) | Large (× ⁴⁄₅) | Extra-Large (× 1) |
| ---: | --------------: | ------------: | ----------------: |
| 32 | 21.333 → 22 | 25.6 → 26 | 32 |
| 48 | 32 | 38.4 → 39 | 48 |
| 64 | 42.666 → 43 | 51.2 → 52 | 64 |
| 96 | 64 | 76.8 → 77 | 96 |
| 128 | 85.333 → 86 | 102.4 → 103 | 128 |
| 256 | 170.666 → 171 | 204.8 → 205 | 256 |

## Colors

Expand Down
17 changes: 8 additions & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ get_config_file() {

with_version() {
local comment="${1}"
echo "$comment ($version)."
echo "$comment ($version)"
}

if ! type -p ctgen >/dev/null; then
Expand All @@ -30,8 +30,8 @@ if ! type -p ctgen >/dev/null; then
fi

declare -A names
names["macOS"]=$(with_version "macOS cursors")
names["macOS-White"]=$(with_version "White macOS cursors")
names["macOS"]=$(with_version "macOS")
names["macOS-White"]=$(with_version "White macOS")

# Cleanup old builds
rm -rf themes bin
Expand All @@ -41,7 +41,7 @@ for key in "${!names[@]}"; do
comment="${names[$key]}"
cfg=$(get_config_file key)

ctgen "$cfg" -p x11 -d "bitmaps/$key" -n "$key" -c "$comment" &
ctgen "configs/x.$cfg" -p x11 -d "bitmaps/$key" -n "$key" -c "$comment XCursors" &
PID=$!
wait $PID
done
Expand All @@ -51,10 +51,9 @@ for key in "${!names[@]}"; do
comment="${names[$key]}"
cfg=$(get_config_file key)

ctgen "$cfg" -p windows -s 16 -d "bitmaps/$key" -n "$key-Small" -c "$comment" &
ctgen "$cfg" -p windows -s 24 -d "bitmaps/$key" -n "$key-Regular" -c "$comment" &
ctgen "$cfg" -p windows -s 32 -d "bitmaps/$key" -n "$key-Large" -c "$comment" &
ctgen "$cfg" -p windows -s 48 -d "bitmaps/$key" -n "$key-Extra-Large" -c "$comment" &
ctgen "configs/win_rg.$cfg" -d "bitmaps/$key" -n "$key-Regular" -c "$comment Regular Windows Cursors" &
ctgen "configs/win_lg.$cfg" -d "bitmaps/$key" -n "$key-Large" -c "$comment Large Windows Cursors" &
ctgen "configs/win_xl.$cfg" -d "bitmaps/$key" -n "$key-Extra-Large" -c "$comment Extra Large Windows Cursors" &
PID=$!
wait $PID
done
Expand All @@ -77,7 +76,7 @@ wait $PID

# Compressing macOS-*-Windows
for key in "${!names[@]}"; do
zip -rv "../bin/${key}-Windows.zip" "${key}-Small-Windows" "${key}-Regular-Windows" "${key}-Large-Windows" "${key}-Extra-Large-Windows" &
zip -rv "../bin/${key}-Windows.zip" "${key}-Regular-Windows" "${key}-Large-Windows" "${key}-Extra-Large-Windows" &
PID=$!
wait $PID
done
Expand Down
130 changes: 130 additions & 0 deletions configs/win_lg.build.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
[theme]
name = 'macOS-Large'
comment = 'macOS Large Windows cursors'
website = 'https://github.com/ful1e5/apple_cursor'

[config]
bitmaps_dir = '' # This config will assigned with `ctgen -d <path>`
out_dir = '../themes'
platforms = 'windows'

[cursors]
[cursors.fallback_settings]
win_sizes = [26, 39, 52, 77, 103, 205]
x_hotspot = 128
y_hotspot = 128
win_delay = 1

[cursors.all-scroll]
png = 'all-scroll.png'
win_name = 'Move'

[cursors.bottom_left_corner]
png = 'bottom_left_corner.png'
win_name = 'Dng2'

[cursors.bottom_right_corner]
png = 'bottom_right_corner.png'
win_name = 'Dng1'

[cursors.cross]
png = 'cross.png'
win_name = 'Cross'

[cursors.crossed_circle]
png = 'crossed_circle.png'
x_hotspot = 56
y_hotspot = 17
win_name = 'Unavailiable'

[cursors.hand1]
png = 'hand1.png'
x_hotspot = 134
y_hotspot = 81
win_name = 'Pan'

[cursors.hand2]
png = 'hand2.png'
x_hotspot = 92
y_hotspot = 53
win_name = 'Link'

[cursors.left_ptr]
png = 'left_ptr.png'
x_hotspot = 80
y_hotspot = 38
win_name = 'Pointer'

[cursors.left_ptr_watch]
png = 'left_ptr_watch-*.png'
x_hotspot = 56
y_hotspot = 17
win_sizes = 77
win_name = 'Work'

[cursors.move]
png = 'move.png'
x_hotspot = 139
y_hotspot = 86
win_name = 'Grabbing'

[cursors.pencil]
png = 'pencil.png'
x_hotspot = 37
y_hotspot = 218
win_name = 'Handwriting'

[cursors.question_arrow]
png = 'question_arrow.png'
x_hotspot = 128
y_hotspot = 169
win_name = 'Help'

[cursors.right_ptr]
png = 'right_ptr.png'
x_hotspot = 179
y_hotspot = 40
win_name = 'Alternate'

[cursors.sb_h_double_arrow]
png = 'sb_h_double_arrow.png'
win_name = 'Horz'

[cursors.sb_v_double_arrow]
png = 'sb_v_double_arrow.png'
win_name = 'Vert'

[cursors.wait]
png = 'wait-*.png'
win_sizes = 77
win_name = 'Busy'

[cursors.xterm]
png = 'xterm.png'
x_hotspot = 129
y_hotspot = 136
win_name = 'Text'

[cursors.zoom-in]
png = 'zoom-in.png'
x_hotspot = 99
y_hotspot = 98
win_name = 'Zoom-in'

[cursors.zoom-out]
png = 'zoom-out.png'
x_hotspot = 99
y_hotspot = 98
win_name = 'Zoom-out'

[cursors.person]
png = 'person.png'
x_hotspot = 56
y_hotspot = 17
win_name = 'Person'

[cursors.pin]
png = 'pin.png'
x_hotspot = 56
y_hotspot = 17
win_name = 'Pin'
130 changes: 130 additions & 0 deletions configs/win_rg.build.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
[theme]
name = 'macOS-Regular'
comment = 'macOS Regular Windows cursors'
website = 'https://github.com/ful1e5/apple_cursor'

[config]
bitmaps_dir = '' # This config will assigned with `ctgen -d <path>`
out_dir = '../themes'
platforms = 'windows'

[cursors]
[cursors.fallback_settings]
win_sizes = [22, 32, 43, 64, 86, 171]
x_hotspot = 128
y_hotspot = 128
win_delay = 1

[cursors.all-scroll]
png = 'all-scroll.png'
win_name = 'Move'

[cursors.bottom_left_corner]
png = 'bottom_left_corner.png'
win_name = 'Dng2'

[cursors.bottom_right_corner]
png = 'bottom_right_corner.png'
win_name = 'Dng1'

[cursors.cross]
png = 'cross.png'
win_name = 'Cross'

[cursors.crossed_circle]
png = 'crossed_circle.png'
x_hotspot = 56
y_hotspot = 17
win_name = 'Unavailiable'

[cursors.hand1]
png = 'hand1.png'
x_hotspot = 134
y_hotspot = 81
win_name = 'Pan'

[cursors.hand2]
png = 'hand2.png'
x_hotspot = 92
y_hotspot = 53
win_name = 'Link'

[cursors.left_ptr]
png = 'left_ptr.png'
x_hotspot = 80
y_hotspot = 38
win_name = 'Pointer'

[cursors.left_ptr_watch]
png = 'left_ptr_watch-*.png'
x_hotspot = 56
y_hotspot = 17
win_sizes = 65
win_name = 'Work'

[cursors.move]
png = 'move.png'
x_hotspot = 139
y_hotspot = 86
win_name = 'Grabbing'

[cursors.pencil]
png = 'pencil.png'
x_hotspot = 37
y_hotspot = 218
win_name = 'Handwriting'

[cursors.question_arrow]
png = 'question_arrow.png'
x_hotspot = 128
y_hotspot = 169
win_name = 'Help'

[cursors.right_ptr]
png = 'right_ptr.png'
x_hotspot = 179
y_hotspot = 40
win_name = 'Alternate'

[cursors.sb_h_double_arrow]
png = 'sb_h_double_arrow.png'
win_name = 'Horz'

[cursors.sb_v_double_arrow]
png = 'sb_v_double_arrow.png'
win_name = 'Vert'

[cursors.wait]
png = 'wait-*.png'
win_sizes = 65
win_name = 'Busy'

[cursors.xterm]
png = 'xterm.png'
x_hotspot = 129
y_hotspot = 136
win_name = 'Text'

[cursors.zoom-in]
png = 'zoom-in.png'
x_hotspot = 99
y_hotspot = 98
win_name = 'Zoom-in'

[cursors.zoom-out]
png = 'zoom-out.png'
x_hotspot = 99
y_hotspot = 98
win_name = 'Zoom-out'

[cursors.person]
png = 'person.png'
x_hotspot = 56
y_hotspot = 17
win_name = 'Person'

[cursors.pin]
png = 'pin.png'
x_hotspot = 56
y_hotspot = 17
win_name = 'Pin'
Loading

0 comments on commit c684a72

Please sign in to comment.