Skip to content

Instantly share code, notes, and snippets.

@syobocat
Last active September 11, 2024 11:45
Show Gist options
  • Save syobocat/dfdd80355e7741fa733198b6c882a1de to your computer and use it in GitHub Desktop.
Save syobocat/dfdd80355e7741fa733198b6c882a1de to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# UmiCursor/ReiCursor Converter for X11/Wayland
# Usage:
# 1. Download UmiCursor/ReiCursor
# https://booth.pm/ja/items/4568548
# https://booth.pm/ja/items/6090702
# 2. Install win2xcur
# https://github.com/quantum5/win2xcur
# 3. Put this script in the same directory as .ani files
# 4. Run this script
# Choose which cursor to convert
CURSOR=UmiCursor
#CURSOR=ReiCursor
# This script installs cursors under ${HOME}/.local/share/icons by default.
# However, it seems that some environments reads cursors only from ${HOME}/.icons .
# To change the install dir, edit the following:
DIST="${HOME}/.local/share/icons"
# If you want to use UmiCursor/ReiCursor as many scenes as possible,
# uncomment the following (may cause inappropriate cursors to be shown):
#MORESYMLINKS=YES
# -*-*-*-*-*-*-*-*-*- #
path=$(which win2xcur)
if [ $? -ne 0 ]; then
echo "win2xcur not found. Exitting..."
exit 1
fi
if [ $(ls | grep -E '.ani$' | wc -l) -eq 0 ]; then
echo "Cursor files not found. Please refer to the usage."
exit 1
fi
case $CURSOR in
UmiCursor )
CURSOR_ARROW="001_Arrow"
CURSOR_HELP="002_Help"
CURSOR_APPSTARTING="003_Appstarting"
CURSOR_WAIT="004_Wait"
CURSOR_CROSSHAIR="005_CrossHair"
CURSOR_IBEAM="006_IBeam"
CURSOR_NWPEN="007_NWPen"
CURSOR_NO="008_No"
CURSOR_SIZENS="009_SizeNS"
CURSOR_SIZEWE="010_SizeWE"
CURSOR_SIZENWSE="011_SizeNWSE"
CURSOR_SIZENESW="012_SizeNESW"
CURSOR_SIZEALL="013_SizeAll"
CURSOR_UPARROW="014_UpArrow"
CURSOR_HAND="015_Hand"
;;
ReiCursor )
CURSOR_ARROW="Rei_通常の選択"
CURSOR_HELP="Rei_ヘルプの選択"
CURSOR_APPSTARTING="Rei_バッググラウンドで作業中"
CURSOR_WAIT="Rei_待ち状態"
CURSOR_CROSSHAIR="Rei_領域選択"
CURSOR_IBEAM="Rei_テキスト選択"
CURSOR_NWPEN="Rei_手書き"
CURSOR_NO="Rei_利用不可"
CURSOR_SIZENS="Rei_上下に拡大・縮小"
CURSOR_SIZEWE="Rei_左右に拡大・縮小"
CURSOR_SIZENWSE="Rei_斜めに拡大・縮小1"
CURSOR_SIZENESW="Rei_斜めに拡大・縮小2"
CURSOR_SIZEALL="Rei_移動"
CURSOR_UPARROW="Rei_代替選択"
CURSOR_HAND="リンクの選択(人物、場所込み)"
;;
* )
echo "Unknown cursor specified. Exitting..."
exit 1
;;
esac
echo "Converting..."
mkdir -p "${DIST}/${CURSOR}/cursors"
ls ./*.ani | xargs -I {} win2xcur {} -o "${DIST}/${CURSOR}/cursors/"
pushd "${DIST}/${CURSOR}/cursors" > /dev/null
mv "${CURSOR_ARROW}" default
mv "${CURSOR_HELP}" help
mv "${CURSOR_APPSTARTING}" progress
mv "${CURSOR_WAIT}" wait
mv "${CURSOR_CROSSHAIR}" crosshair
mv "${CURSOR_IBEAM}" text
mv "${CURSOR_NWPEN}" pencil
mv "${CURSOR_NO}" not-allowed
mv "${CURSOR_SIZENS}" row-resize
mv "${CURSOR_SIZEWE}" col-resize
mv "${CURSOR_SIZENWSE}" nwse-resize
mv "${CURSOR_SIZENESW}" nesw-resize
mv "${CURSOR_SIZEALL}" all-scroll
mv "${CURSOR_UPARROW}" up-arrow
mv "${CURSOR_HAND}" pointer
if [ "${CURSOR}" = "UmiCursor" ]; then
rm 016_Pin
rm 017_Person
fi
ln -s default left_ptr
ln -s default arrow
ln -s default top_left_arrow
ln -s help left_ptr_help
ln -s help question_arrow
ln -s progress left_ptr_watch
ln -s wait watch
ln -s crosshair cross
ln -s crosshair tcross
ln -s crosshair cross_reverse
ln -s crosshair diamond_cross
ln -s text xterm
ln -s not-allowed circle
ln -s not-allowed crossed_circle
ln -s row-resize n-resize
ln -s row-resize s-resize
ln -s row-resize ns-resize
ln -s row-resize top_side
ln -s row-resize bottom_side
ln -s row-resize sb_v_double_arrow
ln -s row-resize v_double_arrow
ln -s row-resize double-arrow
ln -s col-resize e-resize
ln -s col-resize w-resize
ln -s col-resize ew-resize
ln -s col-resize left_side
ln -s col-resize right_side
ln -s col-resize size-hor
ln -s col-resize sb_h_double_arrow
ln -s col-resize h_double_arrow
ln -s nwse-resize se-resize
ln -s nwse-resize nw-resize
ln -s nwse-resize bd_double_arrow
ln -s nwse-resize size_fdiag
ln -s nwse-resize top_left_corner
ln -s nwse-resize bottom_right_corner
ln -s nesw-resize ne-resize
ln -s nesw-resize sw-resize
ln -s nesw-resize fd_double_arrow
ln -s nesw-resize size_bdiag
ln -s nesw-resize top_right_corner
ln -s nesw-resize bottom_left_corner
ln -s all-scroll fleur
ln -s all-scroll size_all
ln -s up-arrow sb_up_arrow
ln -s pointer hand
ln -s pointer hand2
ln -s row-resize 00008160000006810000408080010102
ln -s col-resize 028006030e0e7ebffc7f7070c0600140
ln -s not-allowed 03b6e0fcb3499374a867c041f52298f0
ln -s progress 08e8e1c95fe2fc01f976f1e063a24ccd
ln -s col-resize 14fef782d02440884392942c11205230
ln -s row-resize 2870a09082c103050810ffdffffe0204
ln -s progress 3ecb610c1bf2410f44200f48c40d3599
ln -s all-scroll 4498f0e0c1937ffe01fd06f973665830
ln -s nwse-resize c7088f0f3e6c8088236ef8e1e3e70000
ln -s pointer e29285e634086352946a0e7090d73106
ln -s help d9ce0ab605698f320427677b458ad60b
ln -s nesw-resize fcf1c3c7cd4491d801f1e1c78f100000
if [ "${MORESYMLINKS}" = "YES" ]; then
ln -s default copy
ln -s default alias
ln -s default link
ln -s default pointer-move
ln -s default right_ptr
ln -s default draft_large
ln -s default draft_small
ln -s default dnd-copy
ln -s default dnd-link
ln -s default dnd-move
ln -s default context-menu
ln -s help dnd-ask
ln -s crosshair cell
ln -s crosshair dotbox
ln -s crosshair dot_box_mask
ln -s crosshair draped_box
ln -s crosshair target
ln -s crosshair plus
ln -s text vertical-text
ln -s not-allowed no-drop
ln -s not-allowed dnd-no-drop
ln -s pointer hand1
ln -s pointer openhand
ln -s pointer grab
ln -s pointer grabbing
ln -s pointer dnd-none
ln -s default 6407b0e94181790501fd1e167b474872
ln -s pointer 9d800788f1b08800ae810202380a0822
fi
popd > /dev/null
echo "Converted."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment