mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-14 08:01:14 +01:00
Remove re-exports
This commit is contained in:
parent
0c4fc3ad1d
commit
efa846d40b
3 changed files with 150 additions and 88 deletions
5
api/lua_grpc/examples/default/.luarc.json
Normal file
5
api/lua_grpc/examples/default/.luarc.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||||
|
"workspace.library": ["~/.local/share/pinnacle/lua_grpc"],
|
||||||
|
"runtime.version": "Lua 5.4",
|
||||||
|
}
|
|
@ -42,7 +42,7 @@ use crate::{
|
||||||
window::{window_state::WindowId, WindowElement},
|
window::{window_state::WindowId, WindowElement},
|
||||||
};
|
};
|
||||||
|
|
||||||
use self::pinnacle::{
|
use pinnacle_api_defs::pinnacle::{
|
||||||
input::{
|
input::{
|
||||||
libinput::v0alpha1::SetLibinputSettingRequest,
|
libinput::v0alpha1::SetLibinputSettingRequest,
|
||||||
v0alpha1::{
|
v0alpha1::{
|
||||||
|
@ -54,9 +54,6 @@ use self::pinnacle::{
|
||||||
v0alpha1::QuitRequest,
|
v0alpha1::QuitRequest,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use pinnacle_api_defs::pinnacle;
|
|
||||||
pub use pinnacle_api_defs::FILE_DESCRIPTOR_SET;
|
|
||||||
|
|
||||||
type ResponseStream<T> = Pin<Box<dyn Stream<Item = Result<T, Status>> + Send>>;
|
type ResponseStream<T> = Pin<Box<dyn Stream<Item = Result<T, Status>> + Send>>;
|
||||||
pub type StateFnSender = calloop::channel::Sender<Box<dyn FnOnce(&mut State) + Send>>;
|
pub type StateFnSender = calloop::channel::Sender<Box<dyn FnOnce(&mut State) + Send>>;
|
||||||
|
|
||||||
|
@ -65,7 +62,9 @@ pub struct PinnacleService {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tonic::async_trait]
|
#[tonic::async_trait]
|
||||||
impl pinnacle::v0alpha1::pinnacle_service_server::PinnacleService for PinnacleService {
|
impl pinnacle_api_defs::pinnacle::v0alpha1::pinnacle_service_server::PinnacleService
|
||||||
|
for PinnacleService
|
||||||
|
{
|
||||||
async fn quit(&self, _request: Request<QuitRequest>) -> Result<Response<()>, Status> {
|
async fn quit(&self, _request: Request<QuitRequest>) -> Result<Response<()>, Status> {
|
||||||
tracing::trace!("PinnacleService.quit");
|
tracing::trace!("PinnacleService.quit");
|
||||||
let f = Box::new(|state: &mut State| {
|
let f = Box::new(|state: &mut State| {
|
||||||
|
@ -83,7 +82,9 @@ pub struct InputService {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tonic::async_trait]
|
#[tonic::async_trait]
|
||||||
impl pinnacle::input::v0alpha1::input_service_server::InputService for InputService {
|
impl pinnacle_api_defs::pinnacle::input::v0alpha1::input_service_server::InputService
|
||||||
|
for InputService
|
||||||
|
{
|
||||||
type SetKeybindStream = ResponseStream<SetKeybindResponse>;
|
type SetKeybindStream = ResponseStream<SetKeybindResponse>;
|
||||||
type SetMousebindStream = ResponseStream<SetMousebindResponse>;
|
type SetMousebindStream = ResponseStream<SetMousebindResponse>;
|
||||||
|
|
||||||
|
@ -99,17 +100,25 @@ impl pinnacle::input::v0alpha1::input_service_server::InputService for InputServ
|
||||||
let modifiers = request
|
let modifiers = request
|
||||||
.modifiers()
|
.modifiers()
|
||||||
.fold(ModifierMask::empty(), |acc, modifier| match modifier {
|
.fold(ModifierMask::empty(), |acc, modifier| match modifier {
|
||||||
pinnacle::input::v0alpha1::Modifier::Unspecified => acc,
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Unspecified => acc,
|
||||||
pinnacle::input::v0alpha1::Modifier::Shift => acc | ModifierMask::SHIFT,
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Shift => {
|
||||||
pinnacle::input::v0alpha1::Modifier::Ctrl => acc | ModifierMask::CTRL,
|
acc | ModifierMask::SHIFT
|
||||||
pinnacle::input::v0alpha1::Modifier::Alt => acc | ModifierMask::ALT,
|
}
|
||||||
pinnacle::input::v0alpha1::Modifier::Super => acc | ModifierMask::SUPER,
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Ctrl => {
|
||||||
|
acc | ModifierMask::CTRL
|
||||||
|
}
|
||||||
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Alt => {
|
||||||
|
acc | ModifierMask::ALT
|
||||||
|
}
|
||||||
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Super => {
|
||||||
|
acc | ModifierMask::SUPER
|
||||||
|
}
|
||||||
});
|
});
|
||||||
let key = request
|
let key = request
|
||||||
.key
|
.key
|
||||||
.ok_or_else(|| Status::invalid_argument("no key specified"))?;
|
.ok_or_else(|| Status::invalid_argument("no key specified"))?;
|
||||||
|
|
||||||
use pinnacle::input::v0alpha1::set_keybind_request::Key;
|
use pinnacle_api_defs::pinnacle::input::v0alpha1::set_keybind_request::Key;
|
||||||
let keysym = match key {
|
let keysym = match key {
|
||||||
Key::RawCode(num) => {
|
Key::RawCode(num) => {
|
||||||
tracing::info!("set keybind: {:?}, raw {}", modifiers, num);
|
tracing::info!("set keybind: {:?}, raw {}", modifiers, num);
|
||||||
|
@ -157,11 +166,19 @@ impl pinnacle::input::v0alpha1::input_service_server::InputService for InputServ
|
||||||
let modifiers = request
|
let modifiers = request
|
||||||
.modifiers()
|
.modifiers()
|
||||||
.fold(ModifierMask::empty(), |acc, modifier| match modifier {
|
.fold(ModifierMask::empty(), |acc, modifier| match modifier {
|
||||||
pinnacle::input::v0alpha1::Modifier::Unspecified => acc,
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Unspecified => acc,
|
||||||
pinnacle::input::v0alpha1::Modifier::Shift => acc | ModifierMask::SHIFT,
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Shift => {
|
||||||
pinnacle::input::v0alpha1::Modifier::Ctrl => acc | ModifierMask::CTRL,
|
acc | ModifierMask::SHIFT
|
||||||
pinnacle::input::v0alpha1::Modifier::Alt => acc | ModifierMask::ALT,
|
}
|
||||||
pinnacle::input::v0alpha1::Modifier::Super => acc | ModifierMask::SUPER,
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Ctrl => {
|
||||||
|
acc | ModifierMask::CTRL
|
||||||
|
}
|
||||||
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Alt => {
|
||||||
|
acc | ModifierMask::ALT
|
||||||
|
}
|
||||||
|
pinnacle_api_defs::pinnacle::input::v0alpha1::Modifier::Super => {
|
||||||
|
acc | ModifierMask::SUPER
|
||||||
|
}
|
||||||
});
|
});
|
||||||
let button = request
|
let button = request
|
||||||
.button
|
.button
|
||||||
|
@ -249,7 +266,7 @@ impl pinnacle::input::v0alpha1::input_service_server::InputService for InputServ
|
||||||
|
|
||||||
let discriminant = std::mem::discriminant(&setting);
|
let discriminant = std::mem::discriminant(&setting);
|
||||||
|
|
||||||
use pinnacle::input::libinput::v0alpha1::set_libinput_setting_request::Setting;
|
use pinnacle_api_defs::pinnacle::input::libinput::v0alpha1::set_libinput_setting_request::Setting;
|
||||||
let apply_setting: Box<dyn Fn(&mut libinput::Device) + Send> = match setting {
|
let apply_setting: Box<dyn Fn(&mut libinput::Device) + Send> = match setting {
|
||||||
Setting::AccelProfile(profile) => {
|
Setting::AccelProfile(profile) => {
|
||||||
let profile = AccelProfile::try_from(profile).unwrap_or(AccelProfile::Unspecified);
|
let profile = AccelProfile::try_from(profile).unwrap_or(AccelProfile::Unspecified);
|
||||||
|
@ -394,7 +411,9 @@ pub struct ProcessService {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tonic::async_trait]
|
#[tonic::async_trait]
|
||||||
impl pinnacle::process::v0alpha1::process_service_server::ProcessService for ProcessService {
|
impl pinnacle_api_defs::pinnacle::process::v0alpha1::process_service_server::ProcessService
|
||||||
|
for ProcessService
|
||||||
|
{
|
||||||
type SpawnStream = ResponseStream<SpawnResponse>;
|
type SpawnStream = ResponseStream<SpawnResponse>;
|
||||||
|
|
||||||
async fn spawn(
|
async fn spawn(
|
||||||
|
@ -560,7 +579,7 @@ pub struct TagService {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tonic::async_trait]
|
#[tonic::async_trait]
|
||||||
impl pinnacle::tag::v0alpha1::tag_service_server::TagService for TagService {
|
impl pinnacle_api_defs::pinnacle::tag::v0alpha1::tag_service_server::TagService for TagService {
|
||||||
async fn set_active(&self, request: Request<SetActiveRequest>) -> Result<Response<()>, Status> {
|
async fn set_active(&self, request: Request<SetActiveRequest>) -> Result<Response<()>, Status> {
|
||||||
let request = request.into_inner();
|
let request = request.into_inner();
|
||||||
|
|
||||||
|
@ -571,8 +590,16 @@ impl pinnacle::tag::v0alpha1::tag_service_server::TagService for TagService {
|
||||||
);
|
);
|
||||||
|
|
||||||
let set_or_toggle = match request.set_or_toggle {
|
let set_or_toggle = match request.set_or_toggle {
|
||||||
Some(pinnacle::tag::v0alpha1::set_active_request::SetOrToggle::Set(set)) => Some(set),
|
Some(
|
||||||
Some(pinnacle::tag::v0alpha1::set_active_request::SetOrToggle::Toggle(_)) => None,
|
pinnacle_api_defs::pinnacle::tag::v0alpha1::set_active_request::SetOrToggle::Set(
|
||||||
|
set,
|
||||||
|
),
|
||||||
|
) => Some(set),
|
||||||
|
Some(
|
||||||
|
pinnacle_api_defs::pinnacle::tag::v0alpha1::set_active_request::SetOrToggle::Toggle(
|
||||||
|
_,
|
||||||
|
),
|
||||||
|
) => None,
|
||||||
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -758,7 +785,7 @@ impl pinnacle::tag::v0alpha1::tag_service_server::TagService for TagService {
|
||||||
.ok_or_else(|| Status::invalid_argument("no tag specified"))?,
|
.ok_or_else(|| Status::invalid_argument("no tag specified"))?,
|
||||||
);
|
);
|
||||||
|
|
||||||
use pinnacle::tag::v0alpha1::set_layout_request::Layout;
|
use pinnacle_api_defs::pinnacle::tag::v0alpha1::set_layout_request::Layout;
|
||||||
|
|
||||||
// TODO: from impl
|
// TODO: from impl
|
||||||
let layout = match request.layout() {
|
let layout = match request.layout() {
|
||||||
|
@ -792,10 +819,11 @@ impl pinnacle::tag::v0alpha1::tag_service_server::TagService for TagService {
|
||||||
|
|
||||||
async fn get(
|
async fn get(
|
||||||
&self,
|
&self,
|
||||||
_request: Request<pinnacle::tag::v0alpha1::GetRequest>,
|
_request: Request<pinnacle_api_defs::pinnacle::tag::v0alpha1::GetRequest>,
|
||||||
) -> Result<Response<pinnacle::tag::v0alpha1::GetResponse>, Status> {
|
) -> Result<Response<pinnacle_api_defs::pinnacle::tag::v0alpha1::GetResponse>, Status> {
|
||||||
let (sender, mut receiver) =
|
let (sender, mut receiver) = tokio::sync::mpsc::unbounded_channel::<
|
||||||
tokio::sync::mpsc::unbounded_channel::<pinnacle::tag::v0alpha1::GetResponse>();
|
pinnacle_api_defs::pinnacle::tag::v0alpha1::GetResponse,
|
||||||
|
>();
|
||||||
|
|
||||||
let f = Box::new(move |state: &mut State| {
|
let f = Box::new(move |state: &mut State| {
|
||||||
let tag_ids = state
|
let tag_ids = state
|
||||||
|
@ -809,7 +837,8 @@ impl pinnacle::tag::v0alpha1::tag_service_server::TagService for TagService {
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let _ = sender.send(pinnacle::tag::v0alpha1::GetResponse { tag_ids });
|
let _ =
|
||||||
|
sender.send(pinnacle_api_defs::pinnacle::tag::v0alpha1::GetResponse { tag_ids });
|
||||||
});
|
});
|
||||||
|
|
||||||
self.sender
|
self.sender
|
||||||
|
@ -826,8 +855,9 @@ impl pinnacle::tag::v0alpha1::tag_service_server::TagService for TagService {
|
||||||
|
|
||||||
async fn get_properties(
|
async fn get_properties(
|
||||||
&self,
|
&self,
|
||||||
request: Request<pinnacle::tag::v0alpha1::GetPropertiesRequest>,
|
request: Request<pinnacle_api_defs::pinnacle::tag::v0alpha1::GetPropertiesRequest>,
|
||||||
) -> Result<Response<pinnacle::tag::v0alpha1::GetPropertiesResponse>, Status> {
|
) -> Result<Response<pinnacle_api_defs::pinnacle::tag::v0alpha1::GetPropertiesResponse>, Status>
|
||||||
|
{
|
||||||
let request = request.into_inner();
|
let request = request.into_inner();
|
||||||
|
|
||||||
let tag_id = TagId::Some(
|
let tag_id = TagId::Some(
|
||||||
|
@ -837,7 +867,7 @@ impl pinnacle::tag::v0alpha1::tag_service_server::TagService for TagService {
|
||||||
);
|
);
|
||||||
|
|
||||||
let (sender, mut receiver) = tokio::sync::mpsc::unbounded_channel::<
|
let (sender, mut receiver) = tokio::sync::mpsc::unbounded_channel::<
|
||||||
pinnacle::tag::v0alpha1::GetPropertiesResponse,
|
pinnacle_api_defs::pinnacle::tag::v0alpha1::GetPropertiesResponse,
|
||||||
>();
|
>();
|
||||||
|
|
||||||
let f = Box::new(move |state: &mut State| {
|
let f = Box::new(move |state: &mut State| {
|
||||||
|
@ -850,11 +880,13 @@ impl pinnacle::tag::v0alpha1::tag_service_server::TagService for TagService {
|
||||||
let active = tag.as_ref().map(|tag| tag.active());
|
let active = tag.as_ref().map(|tag| tag.active());
|
||||||
let name = tag.as_ref().map(|tag| tag.name());
|
let name = tag.as_ref().map(|tag| tag.name());
|
||||||
|
|
||||||
let _ = sender.send(pinnacle::tag::v0alpha1::GetPropertiesResponse {
|
let _ = sender.send(
|
||||||
active,
|
pinnacle_api_defs::pinnacle::tag::v0alpha1::GetPropertiesResponse {
|
||||||
name,
|
active,
|
||||||
output_name,
|
name,
|
||||||
});
|
output_name,
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.sender
|
self.sender
|
||||||
|
@ -875,7 +907,9 @@ pub struct OutputService {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tonic::async_trait]
|
#[tonic::async_trait]
|
||||||
impl pinnacle::output::v0alpha1::output_service_server::OutputService for OutputService {
|
impl pinnacle_api_defs::pinnacle::output::v0alpha1::output_service_server::OutputService
|
||||||
|
for OutputService
|
||||||
|
{
|
||||||
type ConnectForAllStream = ResponseStream<ConnectForAllResponse>;
|
type ConnectForAllStream = ResponseStream<ConnectForAllResponse>;
|
||||||
|
|
||||||
async fn set_location(
|
async fn set_location(
|
||||||
|
@ -964,10 +998,11 @@ impl pinnacle::output::v0alpha1::output_service_server::OutputService for Output
|
||||||
|
|
||||||
async fn get(
|
async fn get(
|
||||||
&self,
|
&self,
|
||||||
_request: Request<pinnacle::output::v0alpha1::GetRequest>,
|
_request: Request<pinnacle_api_defs::pinnacle::output::v0alpha1::GetRequest>,
|
||||||
) -> Result<Response<pinnacle::output::v0alpha1::GetResponse>, Status> {
|
) -> Result<Response<pinnacle_api_defs::pinnacle::output::v0alpha1::GetResponse>, Status> {
|
||||||
let (sender, mut receiver) =
|
let (sender, mut receiver) = tokio::sync::mpsc::unbounded_channel::<
|
||||||
tokio::sync::mpsc::unbounded_channel::<pinnacle::output::v0alpha1::GetResponse>();
|
pinnacle_api_defs::pinnacle::output::v0alpha1::GetResponse,
|
||||||
|
>();
|
||||||
|
|
||||||
let f = Box::new(move |state: &mut State| {
|
let f = Box::new(move |state: &mut State| {
|
||||||
let output_names = state
|
let output_names = state
|
||||||
|
@ -976,7 +1011,8 @@ impl pinnacle::output::v0alpha1::output_service_server::OutputService for Output
|
||||||
.map(|output| output.name())
|
.map(|output| output.name())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let _ = sender.send(pinnacle::output::v0alpha1::GetResponse { output_names });
|
let _ = sender
|
||||||
|
.send(pinnacle_api_defs::pinnacle::output::v0alpha1::GetResponse { output_names });
|
||||||
});
|
});
|
||||||
|
|
||||||
self.sender
|
self.sender
|
||||||
|
@ -993,8 +1029,11 @@ impl pinnacle::output::v0alpha1::output_service_server::OutputService for Output
|
||||||
|
|
||||||
async fn get_properties(
|
async fn get_properties(
|
||||||
&self,
|
&self,
|
||||||
request: Request<pinnacle::output::v0alpha1::GetPropertiesRequest>,
|
request: Request<pinnacle_api_defs::pinnacle::output::v0alpha1::GetPropertiesRequest>,
|
||||||
) -> Result<Response<pinnacle::output::v0alpha1::GetPropertiesResponse>, Status> {
|
) -> Result<
|
||||||
|
Response<pinnacle_api_defs::pinnacle::output::v0alpha1::GetPropertiesResponse>,
|
||||||
|
Status,
|
||||||
|
> {
|
||||||
let request = request.into_inner();
|
let request = request.into_inner();
|
||||||
|
|
||||||
let output_name = OutputName(
|
let output_name = OutputName(
|
||||||
|
@ -1004,7 +1043,7 @@ impl pinnacle::output::v0alpha1::output_service_server::OutputService for Output
|
||||||
);
|
);
|
||||||
|
|
||||||
let (sender, mut receiver) = tokio::sync::mpsc::unbounded_channel::<
|
let (sender, mut receiver) = tokio::sync::mpsc::unbounded_channel::<
|
||||||
pinnacle::output::v0alpha1::GetPropertiesResponse,
|
pinnacle_api_defs::pinnacle::output::v0alpha1::GetPropertiesResponse,
|
||||||
>();
|
>();
|
||||||
|
|
||||||
let f = Box::new(move |state: &mut State| {
|
let f = Box::new(move |state: &mut State| {
|
||||||
|
@ -1064,19 +1103,21 @@ impl pinnacle::output::v0alpha1::output_service_server::OutputService for Output
|
||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let _ = sender.send(pinnacle::output::v0alpha1::GetPropertiesResponse {
|
let _ = sender.send(
|
||||||
make,
|
pinnacle_api_defs::pinnacle::output::v0alpha1::GetPropertiesResponse {
|
||||||
model,
|
make,
|
||||||
x,
|
model,
|
||||||
y,
|
x,
|
||||||
pixel_width,
|
y,
|
||||||
pixel_height,
|
pixel_width,
|
||||||
refresh_rate,
|
pixel_height,
|
||||||
physical_width,
|
refresh_rate,
|
||||||
physical_height,
|
physical_width,
|
||||||
focused,
|
physical_height,
|
||||||
tag_ids,
|
focused,
|
||||||
});
|
tag_ids,
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.sender
|
self.sender
|
||||||
|
@ -1097,7 +1138,9 @@ pub struct WindowService {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tonic::async_trait]
|
#[tonic::async_trait]
|
||||||
impl pinnacle::window::v0alpha1::window_service_server::WindowService for WindowService {
|
impl pinnacle_api_defs::pinnacle::window::v0alpha1::window_service_server::WindowService
|
||||||
|
for WindowService
|
||||||
|
{
|
||||||
async fn close(&self, request: Request<CloseRequest>) -> Result<Response<()>, Status> {
|
async fn close(&self, request: Request<CloseRequest>) -> Result<Response<()>, Status> {
|
||||||
let request = request.into_inner();
|
let request = request.into_inner();
|
||||||
|
|
||||||
|
@ -1196,10 +1239,10 @@ impl pinnacle::window::v0alpha1::window_service_server::WindowService for Window
|
||||||
);
|
);
|
||||||
|
|
||||||
let set_or_toggle = match request.set_or_toggle {
|
let set_or_toggle = match request.set_or_toggle {
|
||||||
Some(pinnacle::window::v0alpha1::set_fullscreen_request::SetOrToggle::Set(set)) => {
|
Some(pinnacle_api_defs::pinnacle::window::v0alpha1::set_fullscreen_request::SetOrToggle::Set(set)) => {
|
||||||
Some(set)
|
Some(set)
|
||||||
}
|
}
|
||||||
Some(pinnacle::window::v0alpha1::set_fullscreen_request::SetOrToggle::Toggle(_)) => {
|
Some(pinnacle_api_defs::pinnacle::window::v0alpha1::set_fullscreen_request::SetOrToggle::Toggle(_)) => {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
||||||
|
@ -1248,10 +1291,10 @@ impl pinnacle::window::v0alpha1::window_service_server::WindowService for Window
|
||||||
);
|
);
|
||||||
|
|
||||||
let set_or_toggle = match request.set_or_toggle {
|
let set_or_toggle = match request.set_or_toggle {
|
||||||
Some(pinnacle::window::v0alpha1::set_maximized_request::SetOrToggle::Set(set)) => {
|
Some(pinnacle_api_defs::pinnacle::window::v0alpha1::set_maximized_request::SetOrToggle::Set(set)) => {
|
||||||
Some(set)
|
Some(set)
|
||||||
}
|
}
|
||||||
Some(pinnacle::window::v0alpha1::set_maximized_request::SetOrToggle::Toggle(_)) => None,
|
Some(pinnacle_api_defs::pinnacle::window::v0alpha1::set_maximized_request::SetOrToggle::Toggle(_)) => None,
|
||||||
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1298,10 +1341,10 @@ impl pinnacle::window::v0alpha1::window_service_server::WindowService for Window
|
||||||
);
|
);
|
||||||
|
|
||||||
let set_or_toggle = match request.set_or_toggle {
|
let set_or_toggle = match request.set_or_toggle {
|
||||||
Some(pinnacle::window::v0alpha1::set_floating_request::SetOrToggle::Set(set)) => {
|
Some(pinnacle_api_defs::pinnacle::window::v0alpha1::set_floating_request::SetOrToggle::Set(set)) => {
|
||||||
Some(set)
|
Some(set)
|
||||||
}
|
}
|
||||||
Some(pinnacle::window::v0alpha1::set_floating_request::SetOrToggle::Toggle(_)) => None,
|
Some(pinnacle_api_defs::pinnacle::window::v0alpha1::set_floating_request::SetOrToggle::Toggle(_)) => None,
|
||||||
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1387,8 +1430,16 @@ impl pinnacle::window::v0alpha1::window_service_server::WindowService for Window
|
||||||
);
|
);
|
||||||
|
|
||||||
let set_or_toggle = match request.set_or_toggle {
|
let set_or_toggle = match request.set_or_toggle {
|
||||||
Some(pinnacle::window::v0alpha1::set_tag_request::SetOrToggle::Set(set)) => Some(set),
|
Some(
|
||||||
Some(pinnacle::window::v0alpha1::set_tag_request::SetOrToggle::Toggle(_)) => None,
|
pinnacle_api_defs::pinnacle::window::v0alpha1::set_tag_request::SetOrToggle::Set(
|
||||||
|
set,
|
||||||
|
),
|
||||||
|
) => Some(set),
|
||||||
|
Some(
|
||||||
|
pinnacle_api_defs::pinnacle::window::v0alpha1::set_tag_request::SetOrToggle::Toggle(
|
||||||
|
_,
|
||||||
|
),
|
||||||
|
) => None,
|
||||||
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
None => return Err(Status::invalid_argument("unspecified set or toggle")),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1535,10 +1586,11 @@ impl pinnacle::window::v0alpha1::window_service_server::WindowService for Window
|
||||||
|
|
||||||
async fn get(
|
async fn get(
|
||||||
&self,
|
&self,
|
||||||
_request: Request<pinnacle::window::v0alpha1::GetRequest>,
|
_request: Request<pinnacle_api_defs::pinnacle::window::v0alpha1::GetRequest>,
|
||||||
) -> Result<Response<pinnacle::window::v0alpha1::GetResponse>, Status> {
|
) -> Result<Response<pinnacle_api_defs::pinnacle::window::v0alpha1::GetResponse>, Status> {
|
||||||
let (sender, mut receiver) =
|
let (sender, mut receiver) = tokio::sync::mpsc::unbounded_channel::<
|
||||||
tokio::sync::mpsc::unbounded_channel::<pinnacle::window::v0alpha1::GetResponse>();
|
pinnacle_api_defs::pinnacle::window::v0alpha1::GetResponse,
|
||||||
|
>();
|
||||||
|
|
||||||
let f = Box::new(move |state: &mut State| {
|
let f = Box::new(move |state: &mut State| {
|
||||||
let window_ids = state
|
let window_ids = state
|
||||||
|
@ -1552,7 +1604,8 @@ impl pinnacle::window::v0alpha1::window_service_server::WindowService for Window
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let _ = sender.send(pinnacle::window::v0alpha1::GetResponse { window_ids });
|
let _ = sender
|
||||||
|
.send(pinnacle_api_defs::pinnacle::window::v0alpha1::GetResponse { window_ids });
|
||||||
});
|
});
|
||||||
|
|
||||||
self.sender
|
self.sender
|
||||||
|
@ -1569,8 +1622,11 @@ impl pinnacle::window::v0alpha1::window_service_server::WindowService for Window
|
||||||
|
|
||||||
async fn get_properties(
|
async fn get_properties(
|
||||||
&self,
|
&self,
|
||||||
request: Request<pinnacle::window::v0alpha1::GetPropertiesRequest>,
|
request: Request<pinnacle_api_defs::pinnacle::window::v0alpha1::GetPropertiesRequest>,
|
||||||
) -> Result<Response<pinnacle::window::v0alpha1::GetPropertiesResponse>, Status> {
|
) -> Result<
|
||||||
|
Response<pinnacle_api_defs::pinnacle::window::v0alpha1::GetPropertiesResponse>,
|
||||||
|
Status,
|
||||||
|
> {
|
||||||
let request = request.into_inner();
|
let request = request.into_inner();
|
||||||
|
|
||||||
let window_id = WindowId::Some(
|
let window_id = WindowId::Some(
|
||||||
|
@ -1580,7 +1636,7 @@ impl pinnacle::window::v0alpha1::window_service_server::WindowService for Window
|
||||||
);
|
);
|
||||||
|
|
||||||
let (sender, mut receiver) = tokio::sync::mpsc::unbounded_channel::<
|
let (sender, mut receiver) = tokio::sync::mpsc::unbounded_channel::<
|
||||||
pinnacle::window::v0alpha1::GetPropertiesResponse,
|
pinnacle_api_defs::pinnacle::window::v0alpha1::GetPropertiesResponse,
|
||||||
>();
|
>();
|
||||||
|
|
||||||
let f = Box::new(move |state: &mut State| {
|
let f = Box::new(move |state: &mut State| {
|
||||||
|
@ -1658,14 +1714,16 @@ impl pinnacle::window::v0alpha1::window_service_server::WindowService for Window
|
||||||
}
|
}
|
||||||
} as i32);
|
} as i32);
|
||||||
|
|
||||||
let _ = sender.send(pinnacle::window::v0alpha1::GetPropertiesResponse {
|
let _ = sender.send(
|
||||||
geometry,
|
pinnacle_api_defs::pinnacle::window::v0alpha1::GetPropertiesResponse {
|
||||||
class,
|
geometry,
|
||||||
title,
|
class,
|
||||||
focused,
|
title,
|
||||||
floating,
|
focused,
|
||||||
fullscreen_or_maximized,
|
floating,
|
||||||
});
|
fullscreen_or_maximized,
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.sender
|
self.sender
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
use std::{cell::RefCell, sync::Arc, time::Duration};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::{
|
api::{
|
||||||
msg::Msg,
|
msg::Msg,
|
||||||
protocol::{
|
protocol::{
|
||||||
pinnacle::v0alpha1::pinnacle_service_server::PinnacleServiceServer, InputService,
|
InputService, OutputService, PinnacleService, ProcessService, TagService, WindowService,
|
||||||
OutputService, PinnacleService, ProcessService, TagService, WindowService,
|
|
||||||
},
|
},
|
||||||
ApiState,
|
ApiState,
|
||||||
},
|
},
|
||||||
|
@ -19,6 +16,7 @@ use crate::{
|
||||||
window::WindowElement,
|
window::WindowElement,
|
||||||
XDG_BASE_DIRS,
|
XDG_BASE_DIRS,
|
||||||
};
|
};
|
||||||
|
use pinnacle_api_defs::pinnacle::v0alpha1::pinnacle_service_server::PinnacleServiceServer;
|
||||||
use pinnacle_api_defs::pinnacle::{
|
use pinnacle_api_defs::pinnacle::{
|
||||||
input::v0alpha1::input_service_server::InputServiceServer,
|
input::v0alpha1::input_service_server::InputServiceServer,
|
||||||
output::v0alpha1::output_service_server::OutputServiceServer,
|
output::v0alpha1::output_service_server::OutputServiceServer,
|
||||||
|
@ -55,6 +53,7 @@ use smithay::{
|
||||||
},
|
},
|
||||||
xwayland::{X11Wm, XWayland, XWaylandEvent},
|
xwayland::{X11Wm, XWayland, XWaylandEvent},
|
||||||
};
|
};
|
||||||
|
use std::{cell::RefCell, sync::Arc, time::Duration};
|
||||||
use sysinfo::{ProcessRefreshKind, RefreshKind};
|
use sysinfo::{ProcessRefreshKind, RefreshKind};
|
||||||
|
|
||||||
use crate::input::InputState;
|
use crate::input::InputState;
|
||||||
|
@ -282,7 +281,7 @@ impl State {
|
||||||
};
|
};
|
||||||
|
|
||||||
let refl_service = tonic_reflection::server::Builder::configure()
|
let refl_service = tonic_reflection::server::Builder::configure()
|
||||||
.register_encoded_file_descriptor_set(crate::api::protocol::FILE_DESCRIPTOR_SET)
|
.register_encoded_file_descriptor_set(pinnacle_api_defs::FILE_DESCRIPTOR_SET)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
let addr = "127.0.0.1:8080".parse()?;
|
let addr = "127.0.0.1:8080".parse()?;
|
||||||
|
|
Loading…
Reference in a new issue