{"id":16985271,"url":"https://github.com/malcolmstill/cl-libinput","last_synced_at":"2025-03-22T01:23:27.939Z","repository":{"id":14403657,"uuid":"70300888","full_name":"malcolmstill/cl-libinput","owner":"malcolmstill","description":"Common Lisp wrapper for libinput","archived":false,"fork":false,"pushed_at":"2022-06-24T22:06:52.000Z","size":10,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-14T18:40:58.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/malcolmstill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-08T03:26:08.000Z","updated_at":"2023-07-18T07:00:25.000Z","dependencies_parsed_at":"2022-07-21T21:22:34.677Z","dependency_job_id":null,"html_url":"https://github.com/malcolmstill/cl-libinput","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fcl-libinput","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fcl-libinput/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fcl-libinput/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malcolmstill%2Fcl-libinput/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/malcolmstill","download_url":"https://codeload.github.com/malcolmstill/cl-libinput/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244891223,"owners_count":20527215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T02:43:05.694Z","updated_at":"2025-03-22T01:23:27.911Z","avatar_url":"https://github.com/malcolmstill.png","language":"Common Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cl-libinput\n\nlibinput is a library for handling input devices in Wayland compositors. cl-libinput is a Common Lisp interface to the library.\n\n## Status\n\ncl-libinput is being developed primarily in support of [ulubis](https://github.com/malcolmstill/ulubis) and is therefor feature incomplete. Pull requests adding more of the API are more than welcome.\n\n## Requiremnts\n\ncl-libinput (obiously) requires libinput. It is likely that libinput already exists on your Linux installation if it is recent.\n\n## Installation\n\n```\nCL-USER\u003e (ql:quickload :cl-libinput)\n```\n\n## Example\n\n```\n(in-package :libinput)\n\n(defun handle-event-context (context event)\n  (when (not (null-pointer-p event))\n    (let ((type (event-get-type event)))\n      (cond\n\t((= type keyboard-key) (progn\n\t\t\t\t (format t \"fd: ~A~%\" (get-fd context))\n\t\t\t\t (handle-keyboard event)))\n\t((= type pointer-motion) (handle-pointer-motion event))\n\t((= type pointer-button) (progn\n\t\t\t\t   (format t \"fd: ~A~%\" (get-fd context))\n\t\t\t\t   (handle-pointer-button event)))))\n    (event-destroy event)))\n\n(defun handle-keyboard (event)\n  (let* ((keyboard-event (event-get-keyboard-event event))\n\t (state (event-keyboard-get-key-state keyboard-event))\n\t (key (event-keyboard-get-key keyboard-event)))\n    (format t \"Key: ~A, state: ~A~%\" key state)))\n\n(defun handle-pointer-motion (event)\n  (let* ((pointer-event (event-get-pointer-event event))\n\t (dx (event-pointer-get-dx pointer-event))\n\t (dy (event-pointer-get-dy pointer-event)))\n    ;;(format t \"dx: ~A, dy: ~A~%\" dx dy)\n    ))\n\n(defun handle-pointer-button (event)\n  (let* ((pointer-event (event-get-pointer-event event))\n\t (state (event-pointer-get-button-state pointer-event))\n\t (button (event-pointer-get-button pointer-event)))\n    (format t \"Button: ~A, state: ~A~%\" button state)))\n\n(defun event-loop (context)\n  (dispatch context)\n  (let ((event (get-event context)))\n    (loop :while (not (null-pointer-p event))\n       :do (progn\n\t     (handle-event-context context event)\n\t     (setf event (get-event context))))))\n\n(defun test (\u0026rest paths)\n  (let* ((interface (make-libinput-interface))\n\t (context (path-create-context interface (null-pointer)))\n\t (fd (get-fd context)))\n    (mapcar (lambda (path)\n\t      (path-add-device context path))\n\t    paths)\n    (nix:with-pollfds (pollfds\n\t\t       (pollfd fd nix:pollin))\n      (loop :with ret = (nix:poll pollfds 1 -1)\n\t :do (when ret\n\t       (event-loop context))))))\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalcolmstill%2Fcl-libinput","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmalcolmstill%2Fcl-libinput","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalcolmstill%2Fcl-libinput/lists"}