clickgen


Nameclickgen JSON
Version 2.2.5 PyPI version JSON
download
home_pagehttps://github.com/ful1e5/clickgen
SummaryThe hassle-free cursor building toolbox.
upload_time2024-06-09 09:20:35
maintainerNone
docs_urlNone
authorAbdulkaiz Khatri
requires_python>=3.7.5
licenseNone
keywords cursor xcursor windows linux
VCS
bugtrack_url
requirements Pillow PyYaml attrs numpy toml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Clickgen

[![ci](https://github.com/ful1e5/clickgen/actions/workflows/ci.yml/badge.svg)](https://github.com/ful1e5/clickgen/actions/workflows/ci.yml)
[![code coverage](https://codecov.io/gh/ful1e5/clickgen/branch/main/graph/badge.svg)](https://codecov.io/gh/ful1e5/clickgen)

Clickgen is cross-platform python library for building XCursor and Windows Cursors.

Clickgen's core functionality is heavily inspired by [quantum5/win2xcur](https://github.com/quantum5/win2xcur) from _v2.0.0_ and onwards.

## Notices

<!-- If you're interested, you can learn more about 'sponsor-spotlight' on
 https://dev.to/ful1e5/lets-give-recognition-to-those-supporting-our-work-on-github-sponsors-b00 -->

![shoutout-sponsors](https://sponsor-spotlight.vercel.app/sponsor?login=ful1e5)

> **Note**
> The project's success depends on sponsorships. Meeting sponsorship goals for [ful1e5](https://github.com/ful1e5) GitHub Account will drive new releases and ongoing development.

-   **2024-05-24:** Clickgen now allows cursor bitmap re-canvasing by specifying size using the `cursor_size:canvas_size` format. See [changelog-05212024](https://github.com/ful1e5/clickgen/discussions/59#discussioncomment-9511166)
-   **2023-08-23:** `ctgen` CLI supports `.json` and `.yaml`/`.yml` as configuration file.
-   **2023-08-17:** Cursor size settings moved to `[cursors.fallback_settings]` in config. See [changelog-08172023](https://github.com/ful1e5/clickgen/discussions/59#discussioncomment-6747666)
-   **2022-06-15:** Docker Image support deprecated due to cross-platform compatibility.
-   **2022-07-09:** :warning: All the **functionality and modules are removed from older versions in `v2.0.0`**.
    I will be restricting any updates to the `>=v1.2.0` versions to security updates and hotfixes.
    Check updated documentations for [building cursors from API](#api-examples) and [CLIs](#usage) usage.

## Requirements

-   Python version 3.7.5 or higher
-   [Pillow](https://pypi.org/project/Pillow) >= 8.1.1
-   [PyYaml](https://pypi.org/project/PyYaml) >= 6.0.1
-   [attrs](https://pypi.org/project/attrs) >= 15.0.0
-   [numpy](https://pypi.org/project/numpy) >= 1.21.6
-   [toml](https://pypi.org/project/toml) >= 0.10.2

## Install

```bash
pip3 install clickgen
```

> **Note**
> Distributions' packages are not affiliated with clickgen developers.
> If you encounter any issues with the incorrect installation, you should contact the package maintainer first.

### Arch Linux

-   [AUR](https://aur.archlinux.org/packages/python-clickgen)

## Usage

### `clickgen` CLI

#### Linux Format (XCursor)

For example, if you have to build [ponter.png](https://github.com/ful1e5/clickgen/blob/main/samples/pngs/pointer.png)
file to Linux Format:

```bash
clickgen samples/pngs/pointer.png -x 10 -y 10 -s 22 24 32 -p x11
```

You also **build animated Xcursor** by providing multiple png files to argument and animation delay with `-d`:

```bash
clickgen samples/pngs/wait-001.png samples/pngs/wait-001.png -d 3 -x 10 -y 10 -s 22 24 32 -p x11
```

#### Windows Formats (.cur and .ani)

To build [ponter.png](https://github.com/ful1e5/clickgen/blob/main/samples/pngs/pointer.png)
file to Windows Format (`.cur`):

> **Warning: Windows Animated Cursor only support single size.**

```bash
clickgen samples/pngs/pointer.png -x 10 -y 10 -s 32 -p windows
```

You can also specify the size in the `size:canvas_size` format to enable canvasing:

```bash
clickgen samples/pngs/pointer.png -x 10 -y 10 -s 20:32 -p windows
```

For **animated Windows Cursor** (`.ani`):

```bash
clickgen samples/pngs/wait-001.png samples/pngs/wait-001.png -d 3 -x 10 -y 10 -s 32 -p windows
```

For more information, run `clickgen --help`.

### `ctgen` CLI

This CLI allow you to generate Windows and Linux Cursor themes from config (.toml.yml,and .json) files.

```bash
ctgen sample/sample.json
ctgen sample/sample.toml
ctgen sample/sample.yaml
```

You also provide multiple theme configuration file once as following:

```bash
ctgen sample/sample.toml sample/sample.json
```

Override theme's `name` of theme with `-n` option:

```bash
ctgen sample/sample.toml -n "New Theme"
```

You can run `ctgen --help` to view all available options and you also check
[samples](https://github.com/ful1e5/clickgen/blob/main/samples) directory for more information.

### API Examples

### Static `XCursor`

```python
from clickgen.parser import open_blob
from clickgen.writer import to_x11

with open("samples/pngs/pointer.png", "rb") as p:
    cur = open_blob([p.read()], hotspot=(50, 50))

    # save X11 static cursor
    xresult = to_x11(cur.frames)
    with open("xtest", "wb") as o:
        o.write(xresult)
```

### Animated `XCursor`

```python
from glob import glob
from typing import List

from clickgen.parser import open_blob
from clickgen.writer import to_x11

# Get .png files from directory
fnames = glob("samples/pngs/wait-*.png")
pngs: List[bytes] = []

# Reading as bytes
for f in sorted(fnames):
    with open(f, "rb") as p:
        pngs.append(p.read())

cur = open_blob(pngs, hotspot=(100, 100))

# save X11 animated cursor
result = to_x11(cur.frames)
with open("animated-xtest", "wb") as o:
    o.write(result)
```

### Static `Windows Cursor` (.cur)

```python
from clickgen.parser import open_blob
from clickgen.writer import to_win

with open("samples/pngs/pointer.png", "rb") as p:
    cur = open_blob([p.read()], hotspot=(50, 50))

    # save Windows static cursor
    ext, result = to_win(cur.frames)
    with open(f"test{ext}", "wb") as o:
        o.write(result)
```

### Animated `Windows Cursor` (.ani)

```python
from glob import glob
from typing import List

from clickgen.parser import open_blob
from clickgen.writer import to_win

# Get .png files from directory
fnames = glob("samples/pngs/wait-*.png")
pngs: List[bytes] = []

# Reading as bytes
for f in sorted(fnames):
    with open(f, "rb") as p:
        pngs.append(p.read())

cur = open_blob(pngs, hotspot=(100, 100))

# save Windows animated cursor
ext, result = to_win(cur.frames)
with open(f"test-ani{ext}", "wb") as o:
    o.write(result)
```

### Documentation

Check [wiki](https://github.com/ful1e5/clickgen/wiki) for documentation.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ful1e5/clickgen",
    "name": "clickgen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7.5",
    "maintainer_email": null,
    "keywords": "cursor, xcursor, windows, linux",
    "author": "Abdulkaiz Khatri",
    "author_email": "kaizmandhu@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e8/e4/d1a33e1d9763b15eb95487512d11df89bc740ea1ff8bb497e3db3c931360/clickgen-2.2.5.tar.gz",
    "platform": null,
    "description": "# Clickgen\n\n[![ci](https://github.com/ful1e5/clickgen/actions/workflows/ci.yml/badge.svg)](https://github.com/ful1e5/clickgen/actions/workflows/ci.yml)\n[![code coverage](https://codecov.io/gh/ful1e5/clickgen/branch/main/graph/badge.svg)](https://codecov.io/gh/ful1e5/clickgen)\n\nClickgen is cross-platform python library for building XCursor and Windows Cursors.\n\nClickgen's core functionality is heavily inspired by [quantum5/win2xcur](https://github.com/quantum5/win2xcur) from _v2.0.0_ and onwards.\n\n## Notices\n\n<!-- If you're interested, you can learn more about 'sponsor-spotlight' on\n https://dev.to/ful1e5/lets-give-recognition-to-those-supporting-our-work-on-github-sponsors-b00 -->\n\n![shoutout-sponsors](https://sponsor-spotlight.vercel.app/sponsor?login=ful1e5)\n\n> **Note**\n> The project's success depends on sponsorships. Meeting sponsorship goals for [ful1e5](https://github.com/ful1e5) GitHub Account will drive new releases and ongoing development.\n\n-   **2024-05-24:** Clickgen now allows cursor bitmap re-canvasing by specifying size using the `cursor_size:canvas_size` format. See [changelog-05212024](https://github.com/ful1e5/clickgen/discussions/59#discussioncomment-9511166)\n-   **2023-08-23:** `ctgen` CLI supports `.json` and `.yaml`/`.yml` as configuration file.\n-   **2023-08-17:** Cursor size settings moved to `[cursors.fallback_settings]` in config. See [changelog-08172023](https://github.com/ful1e5/clickgen/discussions/59#discussioncomment-6747666)\n-   **2022-06-15:** Docker Image support deprecated due to cross-platform compatibility.\n-   **2022-07-09:** :warning: All the **functionality and modules are removed from older versions in `v2.0.0`**.\n    I will be restricting any updates to the `>=v1.2.0` versions to security updates and hotfixes.\n    Check updated documentations for [building cursors from API](#api-examples) and [CLIs](#usage) usage.\n\n## Requirements\n\n-   Python version 3.7.5 or higher\n-   [Pillow](https://pypi.org/project/Pillow) >= 8.1.1\n-   [PyYaml](https://pypi.org/project/PyYaml) >= 6.0.1\n-   [attrs](https://pypi.org/project/attrs) >= 15.0.0\n-   [numpy](https://pypi.org/project/numpy) >= 1.21.6\n-   [toml](https://pypi.org/project/toml) >= 0.10.2\n\n## Install\n\n```bash\npip3 install clickgen\n```\n\n> **Note**\n> Distributions' packages are not affiliated with clickgen developers.\n> If you encounter any issues with the incorrect installation, you should contact the package maintainer first.\n\n### Arch Linux\n\n-   [AUR](https://aur.archlinux.org/packages/python-clickgen)\n\n## Usage\n\n### `clickgen` CLI\n\n#### Linux Format (XCursor)\n\nFor example, if you have to build [ponter.png](https://github.com/ful1e5/clickgen/blob/main/samples/pngs/pointer.png)\nfile to Linux Format:\n\n```bash\nclickgen samples/pngs/pointer.png -x 10 -y 10 -s 22 24 32 -p x11\n```\n\nYou also **build animated Xcursor** by providing multiple png files to argument and animation delay with `-d`:\n\n```bash\nclickgen samples/pngs/wait-001.png samples/pngs/wait-001.png -d 3 -x 10 -y 10 -s 22 24 32 -p x11\n```\n\n#### Windows Formats (.cur and .ani)\n\nTo build [ponter.png](https://github.com/ful1e5/clickgen/blob/main/samples/pngs/pointer.png)\nfile to Windows Format (`.cur`):\n\n> **Warning: Windows Animated Cursor only support single size.**\n\n```bash\nclickgen samples/pngs/pointer.png -x 10 -y 10 -s 32 -p windows\n```\n\nYou can also specify the size in the `size:canvas_size` format to enable canvasing:\n\n```bash\nclickgen samples/pngs/pointer.png -x 10 -y 10 -s 20:32 -p windows\n```\n\nFor **animated Windows Cursor** (`.ani`):\n\n```bash\nclickgen samples/pngs/wait-001.png samples/pngs/wait-001.png -d 3 -x 10 -y 10 -s 32 -p windows\n```\n\nFor more information, run `clickgen --help`.\n\n### `ctgen` CLI\n\nThis CLI allow you to generate Windows and Linux Cursor themes from config (.toml.yml,and .json) files.\n\n```bash\nctgen sample/sample.json\nctgen sample/sample.toml\nctgen sample/sample.yaml\n```\n\nYou also provide multiple theme configuration file once as following:\n\n```bash\nctgen sample/sample.toml sample/sample.json\n```\n\nOverride theme's `name` of theme with `-n` option:\n\n```bash\nctgen sample/sample.toml -n \"New Theme\"\n```\n\nYou can run `ctgen --help` to view all available options and you also check\n[samples](https://github.com/ful1e5/clickgen/blob/main/samples) directory for more information.\n\n### API Examples\n\n### Static `XCursor`\n\n```python\nfrom clickgen.parser import open_blob\nfrom clickgen.writer import to_x11\n\nwith open(\"samples/pngs/pointer.png\", \"rb\") as p:\n    cur = open_blob([p.read()], hotspot=(50, 50))\n\n    # save X11 static cursor\n    xresult = to_x11(cur.frames)\n    with open(\"xtest\", \"wb\") as o:\n        o.write(xresult)\n```\n\n### Animated `XCursor`\n\n```python\nfrom glob import glob\nfrom typing import List\n\nfrom clickgen.parser import open_blob\nfrom clickgen.writer import to_x11\n\n# Get .png files from directory\nfnames = glob(\"samples/pngs/wait-*.png\")\npngs: List[bytes] = []\n\n# Reading as bytes\nfor f in sorted(fnames):\n    with open(f, \"rb\") as p:\n        pngs.append(p.read())\n\ncur = open_blob(pngs, hotspot=(100, 100))\n\n# save X11 animated cursor\nresult = to_x11(cur.frames)\nwith open(\"animated-xtest\", \"wb\") as o:\n    o.write(result)\n```\n\n### Static `Windows Cursor` (.cur)\n\n```python\nfrom clickgen.parser import open_blob\nfrom clickgen.writer import to_win\n\nwith open(\"samples/pngs/pointer.png\", \"rb\") as p:\n    cur = open_blob([p.read()], hotspot=(50, 50))\n\n    # save Windows static cursor\n    ext, result = to_win(cur.frames)\n    with open(f\"test{ext}\", \"wb\") as o:\n        o.write(result)\n```\n\n### Animated `Windows Cursor` (.ani)\n\n```python\nfrom glob import glob\nfrom typing import List\n\nfrom clickgen.parser import open_blob\nfrom clickgen.writer import to_win\n\n# Get .png files from directory\nfnames = glob(\"samples/pngs/wait-*.png\")\npngs: List[bytes] = []\n\n# Reading as bytes\nfor f in sorted(fnames):\n    with open(f, \"rb\") as p:\n        pngs.append(p.read())\n\ncur = open_blob(pngs, hotspot=(100, 100))\n\n# save Windows animated cursor\next, result = to_win(cur.frames)\nwith open(f\"test-ani{ext}\", \"wb\") as o:\n    o.write(result)\n```\n\n### Documentation\n\nCheck [wiki](https://github.com/ful1e5/clickgen/wiki) for documentation.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The hassle-free cursor building toolbox.",
    "version": "2.2.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/ful1e5/clickgen/issues",
        "Changelog": "https://github.com/ful1e5/clickgen/blob/main/CHANGELOG.md",
        "Download": "https://pypi.org/project/clickgen/#files",
        "Funding": "https://github.com/sponsors/ful1e5",
        "Homepage": "https://github.com/ful1e5/clickgen",
        "Source": "https://github.com/ful1e5/clickgen",
        "Twitter": "https://twitter.com/ful1e5"
    },
    "split_keywords": [
        "cursor",
        " xcursor",
        " windows",
        " linux"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "069e128fa4a8ac38f68401ed711033e993d8d32097e148bee141efe73b9ebca4",
                "md5": "58cbaedb9f7142a544b19e43a021908e",
                "sha256": "1a7ce572e6cf2bc2cb0d25614b57e87a984e43b34f584b5c7b0f45b4dd9e79f6"
            },
            "downloads": -1,
            "filename": "clickgen-2.2.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "58cbaedb9f7142a544b19e43a021908e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.5",
            "size": 25534,
            "upload_time": "2024-06-09T09:20:33",
            "upload_time_iso_8601": "2024-06-09T09:20:33.914567Z",
            "url": "https://files.pythonhosted.org/packages/06/9e/128fa4a8ac38f68401ed711033e993d8d32097e148bee141efe73b9ebca4/clickgen-2.2.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8e4d1a33e1d9763b15eb95487512d11df89bc740ea1ff8bb497e3db3c931360",
                "md5": "93473a8567e25e57ca67f6e6323267fb",
                "sha256": "6c90946bda0e1bcfb2e38e18628cf3d334f3a79ba91695792c6eaf32ffddb05b"
            },
            "downloads": -1,
            "filename": "clickgen-2.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "93473a8567e25e57ca67f6e6323267fb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.5",
            "size": 21578,
            "upload_time": "2024-06-09T09:20:35",
            "upload_time_iso_8601": "2024-06-09T09:20:35.440975Z",
            "url": "https://files.pythonhosted.org/packages/e8/e4/d1a33e1d9763b15eb95487512d11df89bc740ea1ff8bb497e3db3c931360/clickgen-2.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-09 09:20:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ful1e5",
    "github_project": "clickgen",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "Pillow",
            "specs": [
                [
                    ">=",
                    "8.1.1"
                ]
            ]
        },
        {
            "name": "PyYaml",
            "specs": [
                [
                    ">=",
                    "6.0.1"
                ]
            ]
        },
        {
            "name": "attrs",
            "specs": [
                [
                    ">=",
                    "15.0.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.21.6"
                ]
            ]
        },
        {
            "name": "toml",
            "specs": [
                [
                    ">=",
                    "0.10.2"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "clickgen"
}
        
Elapsed time: 2.34317s