clickgen


Nameclickgen JSON
Version 2.2.2 PyPI version JSON
download
home_pagehttps://github.com/ful1e5/clickgen
SummaryThe hassle-free cursor building toolbox.
upload_time2024-04-24 13:21:53
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.

- **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:

```
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`:

```
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 Cursor only support single size.**

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

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

```
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:

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

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

```
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/7a/f3/07311e3bfda76d7dc895dfdd6a3e33d7bfdd42256ec1408b191fbb01f6c9/clickgen-2.2.2.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- **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```\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```\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 Cursor only support single size.**\n\n```\nclickgen samples/pngs/pointer.png -x 10 -y 10 -s 32 -p windows\n```\n\nFor **animated Windows Cursor** (`.ani`):\n\n```\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```\nctgen sample/sample.toml sample/sample.json\n```\n\nOverride theme's `name` of theme with `-n` option:\n\n```\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.2",
    "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": "252849b5cf5b34208b2309bcd85f2ba81d5174686ae8c96759065f972e2fa26b",
                "md5": "f0f1b9fa8e421521ab2e41f0adefbee4",
                "sha256": "2801dfde7b0603bd3cdbdc42cd749dffe2f64f1254483ad7c395dcafe89652ed"
            },
            "downloads": -1,
            "filename": "clickgen-2.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f0f1b9fa8e421521ab2e41f0adefbee4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.5",
            "size": 24967,
            "upload_time": "2024-04-24T13:21:51",
            "upload_time_iso_8601": "2024-04-24T13:21:51.867212Z",
            "url": "https://files.pythonhosted.org/packages/25/28/49b5cf5b34208b2309bcd85f2ba81d5174686ae8c96759065f972e2fa26b/clickgen-2.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7af307311e3bfda76d7dc895dfdd6a3e33d7bfdd42256ec1408b191fbb01f6c9",
                "md5": "02650149d5220967d7c31acbb0c581c4",
                "sha256": "70d4375eda458b14e821b02c03525bf243b640f689fd398045dbf3cdc075179a"
            },
            "downloads": -1,
            "filename": "clickgen-2.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "02650149d5220967d7c31acbb0c581c4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.5",
            "size": 20793,
            "upload_time": "2024-04-24T13:21:53",
            "upload_time_iso_8601": "2024-04-24T13:21:53.711893Z",
            "url": "https://files.pythonhosted.org/packages/7a/f3/07311e3bfda76d7dc895dfdd6a3e33d7bfdd42256ec1408b191fbb01f6c9/clickgen-2.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-24 13:21:53",
    "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: 0.24015s