/replaceCursor

[Xposed / Magisk] Replace mouse cursor with a custom one / 自定义包括鼠标指针、触控点在内的各种图片资源

Primary LanguageKotlinMIT LicenseMIT

Replace Cursor

Replace mouse cursor with a custom one.

自定义包括鼠标指针、触控点在内的各种图片资源。

Note: You can use Magisk + RRO for better experience. See magisk folder for more information. (be aware of SELinux context, btw.)

Demo picture, showing UI and example cursor

How to use / 用法

Tested on: Android 10 (AOSP), Android 12 (MIUI 13)

  1. Select System framework (package name may be android or system or empty, see this) in module scope and activate the module
  2. Force stop module
  3. Add resources to change. Please make sure that image sizes are bigger than hotspot (cursor left-top corner / touch point), otherwise nothing will show.
  4. Reboot (you MUST reboot when you modify anything, or changes will not be applied until next reboot)
  5. Reverse engineer /system/framework/framework-res.apk to find out the resource ID of the cursor you want to replace.

For MiPad users, install MaxMiPad and enable No Magic Pointer.

If you have Windows-style .ani cursors, you can use ani2png to convert them. For example, use ls -a *.ani | xargs -L1 ani2png to convert all .ani files in current directory to .png files.

Common resources / 常用资源

From MIUI 13, Android 12.

Resource ID Description HotSpot
pointer_spot_touch Touch point (22, 22)
pointer_arrow Mouse Pointer (Arrow) (5, 5)
pointer_hand Mouse Pointer (Hand, for example when hover on sth. clickable) (9, 4)
pointer_text Mouse Pointer (Looks like |, for editing vertical text input) (12, 12)

Please note that the images may be scaled. See Android 加载 drawable 中图片后自动缩放的原理 and Android drawable微技巧,你所不知道的drawable的那些细节 and getResources().getDisplayMetrics().density 的理解 for more informaton. In my case, 360x360 on a xhdpi device becomes 135x135 (360 * (240 / 320) / 2 = 135, not sure). You may need to manually adjust size & padding (border) to fit size & hotspot.

Mouse-related resource-id may have a _large suffix, used when Accessibility -> Large mouse pointer(大号鼠标指针) is enabled.

Module Scope

  • android

Project URL

Home URL: https://github.com/Young-Lord/replaceCursor

Xposed Modules Repo URL: https://github.com/Xposed-Modules-Repo/moe.lyniko.replacecursor

License

Apache-2.0 License or MIT License are all OK.

Thanks

TODO

Currently, this module use SharedPreferences to store images, which is really shitty. Anyone is free to improve this module.

Also, I am too low to modify hotspot using Xposed. If you know how to do this, please tell me.

Also: Origin image resolution, disable scaling.