cursor

The global cursor. This is automatically registered with all pointer devices (ex. mouse, tablet stylus, etc.) but also controllable programatically.

Under the hood, catnip uses XCursor, which allows compatability with many existing cursor themes. Note that this also means that catnip is compatible with XCursor Environment Variables.

local cursor = require('catnip').cursor

Fields

Fields

cursor.x

---@class CatnipCursor
...
---@field x number
...

The x-coordinate of the cursor (in pixels).

cursor.y

---@class CatnipCursor
...
---@field y number
...

The y-coordinate of the cursor (in pixels).

cursor.name

---@class CatnipCursor
...
---@field name string
...

The XCursor name to use for the cursor.

This value should match a filename in the cursors/ subdirectory of the current cursor theme.

catnip.cursor.name = "pointer"
catnip.cursor.name = "grabbing"
catnip.cursor.name = "not-allowed"
catnip.cursor.name = "default"

cursor.size

---@class CatnipCursor
...
---@field size number
...

The size of the cursor (in pixels).

cursor.theme

---@class CatnipCursor
...
---@field theme string
...

The XCursor theme to use for the cursor.

This value should match the directory name of the cursor theme. Some common paths to store cursor themes include:

  • /usr/share/icons
  • ~/.local/share/icons
  • ~/.icons
catnip.cursor.theme = "adwaita"
catnip.cursor.theme = "bibata"
catnip.cursor.theme = "phinger"
catnip.cursor.theme = "default"