Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ziqi-yang/greetd_ipc
[mirror] Zig library for interacting with [greetd](https://sr.ht/~kennylevinsen/greetd/) ipc.
https://github.com/ziqi-yang/greetd_ipc
greetd ipc zig
Last synced: 4 days ago
JSON representation
[mirror] Zig library for interacting with [greetd](https://sr.ht/~kennylevinsen/greetd/) ipc.
- Host: GitHub
- URL: https://github.com/ziqi-yang/greetd_ipc
- Owner: Ziqi-Yang
- License: mit
- Created: 2024-03-24T04:20:05.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-08-18T09:22:14.000Z (3 months ago)
- Last Synced: 2024-10-10T23:33:18.337Z (26 days ago)
- Topics: greetd, ipc, zig
- Language: Zig
- Homepage: https://codeberg.org/meow_king/greetd_ipc
- Size: 16.6 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Greetd_IPC
## Installation
Supported Zig Version: `0.13`.
``` bash
zig fetch 'https://codeberg.org/meow_king/greetd_ipc/archive/v0.1.1.tar.gz' --save
```Then you can add this dependency into `build.zig` file:
``` zig
const dep = b.dependency("greetd_ipc", .{ .target = target, .optimize = optimize });
const module = dep.module("greetd_ipc");
exe.root_module.addImport("greetd_ipc", module);
```For other version of Zig, you can include `greetd-ipc.zig` file into
your source directory.## Usage
``` zig
const std = @import("std");pub fn main() !void {
var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){};
defer if (gpa_impl.deinit() == .leak) @panic("MEMORY LEAK");
const gpa = gpa_impl.allocator();const gipc: GreetdIPC = try GreetdIPC.new(null, gpa);
defer gipc.deinit();
const request: Request = .{ .create_session = .{ .username = "user"}};
try gipc.sendMsg(request);
const response = try gipc.readMsg();
std.debug.print("{s}\n", .{std.json.fmt(response, .{})});
}
```## Run Example
Build `fakegreet` from [greetd](https://git.sr.ht/~kennylevinsen/greetd)
repo.``` bash
zig build -Dexample=examples/demo.zig run-example
fakegreet ./zig-out/bin/demo
```Or you can run the following command if you have
[just](https://github.com/casey/just) installed.``` bash
just run
```Note `fakegreet` is a testing tool inside greetd's repo. see
[source](https://git.sr.ht/~kennylevinsen/greetd/tree/master/item/fakegreet/src/main.rs).