Skip to content

Commit

Permalink
feat: support Plasma's SVG cursors implementation (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
trowgundam authored Oct 14, 2024
1 parent 71c2d66 commit 4bcb0c1
Show file tree
Hide file tree
Showing 48 changed files with 557 additions and 0 deletions.
25 changes: 25 additions & 0 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ convert_to_x11cursor() {
done
}

write_scalable() {
local src_dir="$1"
local out_dir="$2"
local config base_name

[ -d "$src_dir" ] || return 1

if [ -d "$out_dir" ]; then
rm -rf "$out_dir"
fi

mkdir -p "$out_dir"

for config in "$CONFIG_DIR"/*.json; do
[ -f "$config" ] || continue
base_name="$(basename "$config" .json)"
cursor_out="$out_dir/$base_name"
mkdir "$cursor_out"
find "$src_dir" -type f \( -name "$base_name-??.svg" -o -name "$base_name.svg" \) ! -name "*_24.svg" -exec cp {} "$cursor_out" \;
cp "$config" "$cursor_out/metadata.json"
done
}

create_aliases() {
local out_dir="$1"
local symlink target
Expand Down Expand Up @@ -156,7 +179,9 @@ for accent in $ACCENTS; do
theme_png_dir="$PNG_DIR/$theme_name"

convert_to_x11cursor "$theme_png_dir" "$theme_out_dir/cursors"
write_scalable "$theme_src_dir" "$theme_out_dir/cursors_scalable"
create_aliases "$theme_out_dir/cursors"
create_aliases "$theme_out_dir/cursors_scalable"

cp -f "$theme_src_dir/index.theme" "$theme_out_dir"
cp -f "$AUTHORS" "$theme_out_dir"
Expand Down
8 changes: 8 additions & 0 deletions src/config/alias.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "alias.svg",
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/all-scroll.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "all-scroll.svg",
"hotspot_x": 11,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/bottom_left_corner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "bottom_left_corner.svg",
"hotspot_x": 4,
"hotspot_y": 18,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/bottom_right_corner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "bottom_right_corner.svg",
"hotspot_x": 19,
"hotspot_y": 18,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/bottom_side.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "bottom_side.svg",
"hotspot_x": 11,
"hotspot_y": 16,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/cell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "cell.svg",
"hotspot_x": 11,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/center_ptr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "center_ptr.svg",
"hotspot_x": 11,
"hotspot_y": 5,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/col-resize.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "col-resize.svg",
"hotspot_x": 11,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/color-picker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "color-picker.svg",
"hotspot_x": 4,
"hotspot_y": 18,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/context-menu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "context-menu.svg",
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/copy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "copy.svg",
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/crosshair.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "crosshair.svg",
"hotspot_x": 11,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "default.svg",
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/dnd-move.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "dnd-move.svg",
"hotspot_x": 11,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/dnd-no-drop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "dnd-no-drop.svg",
"hotspot_x": 11,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/down-arrow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "down-arrow.svg",
"hotspot_x": 11,
"hotspot_y": 18,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/draft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "draft.svg",
"hotspot_x": 4,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/fleur.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "fleur.svg",
"hotspot_x": 11,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/help.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "help.svg",
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/left-arrow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "left-arrow.svg",
"hotspot_x": 4,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/left_side.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "left_side.svg",
"hotspot_x": 7,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/no-drop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "no-drop.svg",
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/not-allowed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "not-allowed.svg",
"hotspot_x": 11,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/openhand.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "openhand.svg",
"hotspot_x": 11,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/pencil.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "pencil.svg",
"hotspot_x": 5,
"hotspot_y": 18,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/pirate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "pirate.svg",
"hotspot_x": 11,
"hotspot_y": 8,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/pointer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "pointer.svg",
"hotspot_x": 9,
"hotspot_y": 4,
"nominal_size": 24
}
]
86 changes: 86 additions & 0 deletions src/config/progress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
{
"filename": "progress-01.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-02.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-03.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-04.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-05.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-06.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-07.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-08.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-09.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-10.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-11.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
},
{
"filename": "progress-12.svg",
"delay": 30,
"hotspot_x": 2,
"hotspot_y": 1,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/right-arrow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "right-arrow.svg",
"hotspot_x": 19,
"hotspot_y": 11,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/right_ptr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "right_ptr.svg",
"hotspot_x": 21,
"hotspot_y": 1,
"nominal_size": 24
}
]
8 changes: 8 additions & 0 deletions src/config/right_side.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"filename": "right_side.svg",
"hotspot_x": 16,
"hotspot_y": 11,
"nominal_size": 24
}
]
Loading

0 comments on commit 4bcb0c1

Please sign in to comment.