Create your own mouse cursor theme: Difference between revisions

From KDE UserBase Wiki
(Redirect to Develop)
Tag: Replaced
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
== How-To ==
Moved to https://develop.kde.org/docs/features/cursor/
 
* Create a PNG file of the cursor you want. Preferrably at least in size 32x32 but you can also create multiple resolutions and bundle those into one cursor file. Save this as <code>$(filename).png</code> (e.g. <code>default.png</code> for a regular cursor).
* Determine the pixel where the hotspot should sit. The hotspot of a cursor is the point where “the click occurs”. (If you have multiple resolutions for your new cursor, you have to do this step for each of them). It’s necessary to use graphic editing software capable of determining the exact pixel for the hotspot. KDE’s own [https://krita.org Krita] is well suited for this task but of course other software works just as well.
* Create a <code>$(filename).cursor</code> file with the following content: <code>$(resolution) $(hotspot-x) $(hotspot-y) $(filename)</code> in one line (e.g. <code>32 10 5 default.png</code>).
* Open a terminal in the working directory and run <code>xcursorgen $(filename).cursor $(filename)</code> (e.g. <code>xcursorgen default.cursor default</code>).<ref>If you want to create animated cursors (like <code>wait</code>) the procedure is a bit different. You need one PNG for each animation frame (<code>$(filename)_#.png</code>). Then add all of these as a list to the <code>$(filename).cursor</code> file with the following content: <code>$(resolution) $(hotspot-x) $(hotspot-y) $(filename) $(animationtime)</code> (e.g. <code>32 16 16 wait_1.png 50 16 16 wait_2.png 50</code> each of them in a separate line).</ref>
* Repeat steps 1-4 for all the different cursors you want to create.
* Copy the newly created set of X11 cursors to a fresh subdirectory <code>cursors/</code> inside a directory that you name after your new cursor theme <code>$(themename)/</code> (e.g. <code>KoolKursors/cursors/</code>).
* Create [https://en.wikipedia.org/wiki/Symbolic_link#POSIX_and_Unix-like_operating_systems symlinks] for all the aliases of the cursors <code>ln -s $(filename).png $(alias).png</code> (e.g. <code>ln -s default.png left_ptr.png</code>).<ref>This task can/should be scripted, provided that you have a complete list of regular cursor names and their irregular aliases. Note that this step might cause some frustration regarding incomplete lists of cursor name aliases.</ref>
* Create a <code>index.theme</code> file in <code>themename/</code> (Note: not in <code>cursors/</code> but in its parent directory) and fill it with the necessary information like theme name, desription and possibly a fallback cursor theme.<ref>If you want to add translations for multiple languages, you can do so by using language tags like <code>[en]</code>, <code>[de]</code>, <code>[fr]</code>, etc. for each language (e.g. <code>Comment[en]=My very own cursor theme</code>). Put each of them in a separate line within the <code>index.theme</code> file.</ref> An exemplary <code>index.theme</code> file might look like this:
 
<pre>[Icon Theme]
Name=KoolKursors
Comment=My very own cursor theme
Inherits=breeze_cursors</pre>
* Place the whole <code>themename/</code> folder and its freshly created content in <code>~/.local/share/icons</code>.
* Select your new cursor theme in the system settings of your OS.
 
Done. Enjoy your new KoolKursors theme.
 
<references />

Latest revision as of 19:18, 25 February 2024