srctree

Gregory Mullen parent e37af094 34e56b25
some things work

some things... not so much
filename was Deleted added: 118, removed: 3, total 115
@@ -0,0 +1,56 @@
pub const obs = @cImport({
@cInclude("obs/util/base.h");
@cInclude("obs/obs-module.h");
@cInclude("obs/obs-config.h");
@cInclude("obs/obs-data.h");
@cInclude("obs/obs-properties.h");
@cInclude("obs/obs-service.h");
});
const obs_frontend_cb = *const fn (?*anyopaque) callconv(.C) void;
extern "obs-frontend-api" fn obs_frontend_add_tools_menu_item(name: [*:0]const u8, cb: obs_frontend_cb, ?*anyopaque) void;
 
pub fn init() void {
propertiesInit();
//obs.obs_register_service(&focus_service);
}
 
fn propertiesInit() void {
obs_frontend_add_tools_menu_item("click".ptr, clicked, null);
 
const props: ?*obs.obs_properties_t = obs.obs_properties_create();
_ = obs.obs_properties_add_bool(props, "blerg", "description");
 
//
//
const data: ?*obs.obs_data_t = obs.obs_data_create();
obs.obs_data_set_string(data, "set string", "this");
}
 
fn clicked(_: ?*anyopaque) callconv(.C) void {
obs.blog(obs.LOG_INFO, "clicked");
}
 
fn createService(_: ?*obs.struct_obs_data, _: ?*obs.struct_obs_service) callconv(.C) ?*anyopaque {
return null;
}
 
fn destroyService(_: ?*anyopaque) callconv(.C) void {}
 
fn getName(_: ?*anyopaque) callconv(.C) [*:0]const u8 {
return "Service Name";
}
 
fn getProperties(_: ?*anyopaque) callconv(.C) ?*obs.obs_properties_t {
const ppts: ?*obs.obs_properties_t = obs.obs_properties_create();
 
_ = obs.obs_properties_add_bool(ppts, "my_bool", obs.obs_module_text("MyBool"));
return ppts;
}
 
const focus_service: obs.obs_service_info = obs.obs_service_info{
.id = "focus_service",
.create = createService,
.destroy = destroyService,
.get_name = getName,
.get_properties = getProperties,
};
 
src/root.zig added: 118, removed: 3, total 115
@@ -1,4 +1,6 @@
const std = @import("std");
const sway_ipc = @import("sway-ipc.zig");
const gui = @import("gui.zig");
 
pub const obs = @cImport({
@cInclude("obs/util/base.h");
@@ -34,6 +36,28 @@ export fn obs_module_name() [*:0]const u8 {
export fn obs_module_description() [*:0]const u8 {
return "it does stuff";
}
 
export fn obs_module_load() bool {
obs.blog(obs.LOG_INFO, "plugin loaded successfully (version %s)", PLUGIN_VERSION);
//gui.init();
 
enumScene();
return true;
}
 
fn enumScene() void {
obs.obs_enum_scenes(enumSceneCb, null);
}
 
fn enumSceneCb(_: ?*anyopaque, _: ?*obs.obs_source_t) callconv(.C) bool {
//const char: [*:0]u8 = scene.?.get_name(data);
 
//obs.blog(obs.LOG_INFO, "plugin data (found scene %s)", char);
return true;
}
 
fn enumSceneItemCb(_: ?*obs.obs_scene_t, _: ?*obs.obs_sceneitem_t, _: ?*void) callconv(.C) void {}
 
// TODO
// thread
// socket
 
filename was Deleted added: 118, removed: 3, total 115
@@ -0,0 +1,35 @@
pub const Payload = enum(i32) {
RUN_COMMAND = 0, // Runs the payload as sway commands
GET_WORKSPACES = 1, // Get the list of current workspaces
SUBSCRIBE = 2, // Subscribe the IPC connection to the events listed in the payload
GET_OUTPUTS = 3, // Get the list of current outputs
GET_TREE = 4, // Get the node layout tree
GET_MARKS = 5, // Get the names of all the marks currently set
GET_BAR_CONFIG = 6, // Get the specified bar config or a list of bar config names
GET_VERSION = 7, // Get the version of sway that owns the IPC socket
GET_BINDING_MODES = 8, // Get the list of binding mode names
GET_CONFIG = 9, // Returns the config that was last loaded
SEND_TICK = 10, // Sends a tick event with the specified payload
SYNC = 11, // Replies failure object for i3 compatibility
GET_BINDING_STATE = 12, // Request the current binding state, e.g. the currently active binding mode name.
GET_INPUTS = 100, // Get the list of input devices
GET_SEATS = 101, // Get the list of seats
};
 
pub const Message = packed struct {
magic: [6]u8 = "i3-ipc",
length: i32,
payload_type: Payload,
};
 
pub const Connection = struct {
socket: []const u8,
 
pub fn connect(c: *Connection) void {
_ = c;
}
 
pub fn loop(c: *Connection) void {
_ = c;
}
};