2024-01-22 21:04:08 -06:00
|
|
|
-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
-- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
2024-01-11 21:58:35 -06:00
|
|
|
local client = require("pinnacle.grpc.client")
|
|
|
|
|
2024-01-14 19:53:43 -06:00
|
|
|
---The entry point to configuration.
|
|
|
|
---
|
|
|
|
---This module contains one function: `setup`, which is how you'll access all the ways to configure Pinnacle.
|
2024-02-07 21:39:56 -06:00
|
|
|
---@class Pinnacle
|
2024-01-12 17:20:34 -06:00
|
|
|
local pinnacle = {
|
2024-02-07 21:39:56 -06:00
|
|
|
---@type Input
|
|
|
|
input = require("pinnacle.input"),
|
|
|
|
---@type Tag
|
|
|
|
tag = require("pinnacle.tag"),
|
|
|
|
---@type Output
|
|
|
|
output = require("pinnacle.output"),
|
|
|
|
---@type Window
|
|
|
|
window = require("pinnacle.window"),
|
|
|
|
---@type Process
|
|
|
|
process = require("pinnacle.process"),
|
2024-03-14 17:31:32 -05:00
|
|
|
---@type Util
|
|
|
|
util = require("pinnacle.util"),
|
|
|
|
---@type Layout
|
|
|
|
layout = require("pinnacle.layout"),
|
2024-01-12 17:20:34 -06:00
|
|
|
}
|
2024-01-11 21:58:35 -06:00
|
|
|
|
2024-01-14 19:35:54 -06:00
|
|
|
---Quit Pinnacle.
|
2024-02-07 21:39:56 -06:00
|
|
|
function pinnacle.quit()
|
|
|
|
client.unary_request({
|
2024-01-11 21:58:35 -06:00
|
|
|
service = "pinnacle.v0alpha1.PinnacleService",
|
|
|
|
method = "Quit",
|
|
|
|
request_type = "pinnacle.v0alpha1.QuitRequest",
|
|
|
|
data = {},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
---Setup Pinnacle.
|
2024-01-14 20:03:58 -06:00
|
|
|
---
|
2024-02-07 21:39:56 -06:00
|
|
|
---You must pass in a function that takes in the `Pinnacle` table. This table is how you'll access the other config modules.
|
2024-01-16 16:24:34 -06:00
|
|
|
---
|
2024-02-07 21:39:56 -06:00
|
|
|
---You can also `require` the other modules. Just be sure not to call any of their functions outside this
|
|
|
|
---setup function.
|
2024-01-14 20:03:58 -06:00
|
|
|
---
|
2024-01-11 21:58:35 -06:00
|
|
|
---@param config_fn fun(pinnacle: Pinnacle)
|
|
|
|
function pinnacle.setup(config_fn)
|
|
|
|
require("pinnacle.grpc.protobuf").build_protos()
|
2024-01-12 17:20:34 -06:00
|
|
|
|
2024-02-07 21:39:56 -06:00
|
|
|
config_fn(pinnacle)
|
2024-01-11 21:58:35 -06:00
|
|
|
|
2024-03-14 17:31:32 -05:00
|
|
|
local success, err = pcall(client.loop.loop, client.loop)
|
|
|
|
if not success then
|
|
|
|
print(err)
|
|
|
|
end
|
2024-01-11 21:58:35 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
return pinnacle
|