mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-13 08:01:05 +01:00
Move stuff to where they should be
This commit is contained in:
parent
87574a40e3
commit
9da918bc40
6 changed files with 105 additions and 68 deletions
|
@ -1,7 +1,7 @@
|
||||||
use xkbcommon::xkb::Keysym;
|
use xkbcommon::xkb::Keysym;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
msg::{Args, CallbackId, KeyIntOrString, Modifier, MouseEdge, Msg},
|
msg::{Args, CallbackId, KeyIntOrString, Msg},
|
||||||
send_msg, CALLBACK_VEC,
|
send_msg, CALLBACK_VEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,17 +69,34 @@ impl Input {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A mouse button.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum MouseButton {
|
pub enum MouseButton {
|
||||||
|
/// The left mouse button.
|
||||||
Left = 0x110,
|
Left = 0x110,
|
||||||
|
/// The right mouse button.
|
||||||
Right,
|
Right,
|
||||||
|
/// The middle mouse button, pressed usually by clicking the scroll wheel.
|
||||||
Middle,
|
Middle,
|
||||||
|
///
|
||||||
Side,
|
Side,
|
||||||
|
///
|
||||||
Extra,
|
Extra,
|
||||||
|
///
|
||||||
Forward,
|
Forward,
|
||||||
|
///
|
||||||
Back,
|
Back,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The edge on which you want things to trigger.
|
||||||
|
#[derive(Debug, Hash, serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub enum MouseEdge {
|
||||||
|
/// Actions will be triggered on button press.
|
||||||
|
Press,
|
||||||
|
/// Actions will be triggered on button release.
|
||||||
|
Release,
|
||||||
|
}
|
||||||
|
|
||||||
impl From<char> for KeyIntOrString {
|
impl From<char> for KeyIntOrString {
|
||||||
fn from(value: char) -> Self {
|
fn from(value: char) -> Self {
|
||||||
Self::String(value.to_string())
|
Self::String(value.to_string())
|
||||||
|
@ -97,3 +114,18 @@ impl From<Keysym> for KeyIntOrString {
|
||||||
Self::Int(value.raw())
|
Self::Int(value.raw())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A modifier key.
|
||||||
|
#[derive(Debug, PartialEq, Eq, Copy, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum Modifier {
|
||||||
|
/// The shift key.
|
||||||
|
Shift,
|
||||||
|
/// The control key.
|
||||||
|
Ctrl,
|
||||||
|
/// The alt key.
|
||||||
|
Alt,
|
||||||
|
/// The super key.
|
||||||
|
///
|
||||||
|
/// This is also known as the Windows key, meta, or Mod4 for those coming from Xorg.
|
||||||
|
Super,
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
|
//! The Rust implementation of the Pinnacle API.
|
||||||
|
|
||||||
mod input;
|
mod input;
|
||||||
mod msg;
|
mod msg;
|
||||||
mod output;
|
mod output;
|
||||||
|
@ -6,9 +10,9 @@ mod tag;
|
||||||
mod window;
|
mod window;
|
||||||
|
|
||||||
use input::Input;
|
use input::Input;
|
||||||
|
pub use input::Modifier;
|
||||||
pub use input::MouseButton;
|
pub use input::MouseButton;
|
||||||
pub use msg::Modifier;
|
pub use input::MouseEdge;
|
||||||
pub use msg::MouseEdge;
|
|
||||||
use output::Output;
|
use output::Output;
|
||||||
use tag::Tag;
|
use tag::Tag;
|
||||||
use window::Window;
|
use window::Window;
|
||||||
|
@ -172,10 +176,18 @@ fn request(request: Request) -> RequestResponse {
|
||||||
response
|
response
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The entry to configuration.
|
||||||
|
///
|
||||||
|
/// This struct houses every submodule you'll need to configure Pinnacle.
|
||||||
pub struct Pinnacle {
|
pub struct Pinnacle {
|
||||||
|
/// Process management.
|
||||||
pub process: Process,
|
pub process: Process,
|
||||||
|
/// Window management.
|
||||||
pub window: Window,
|
pub window: Window,
|
||||||
|
/// Input management.
|
||||||
pub input: Input,
|
pub input: Input,
|
||||||
|
/// Output management.
|
||||||
pub output: Output,
|
pub output: Output,
|
||||||
|
/// Tag management.
|
||||||
pub tag: Tag,
|
pub tag: Tag,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,15 @@
|
||||||
use std::num::NonZeroU32;
|
use std::num::NonZeroU32;
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
output::OutputName,
|
||||||
|
tag::{Layout, TagId},
|
||||||
|
window::{FloatingOrTiled, FullscreenOrMaximized, WindowId},
|
||||||
|
Modifier, MouseEdge,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, Hash, PartialEq, Eq, serde::Serialize, serde::Deserialize, Clone, Copy)]
|
#[derive(Debug, Hash, PartialEq, Eq, serde::Serialize, serde::Deserialize, Clone, Copy)]
|
||||||
pub struct CallbackId(pub u32);
|
pub struct CallbackId(pub u32);
|
||||||
|
|
||||||
#[derive(Debug, Hash, serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub enum MouseEdge {
|
|
||||||
Press,
|
|
||||||
Release,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A unique identifier for each window.
|
|
||||||
#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub enum WindowId {
|
|
||||||
/// A config API returned an invalid window. It should be using this variant.
|
|
||||||
None,
|
|
||||||
/// A valid window id.
|
|
||||||
#[serde(untagged)]
|
|
||||||
Some(u32),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub enum TagId {
|
|
||||||
None,
|
|
||||||
#[serde(untagged)]
|
|
||||||
Some(u32),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A unique identifier for an output.
|
|
||||||
///
|
|
||||||
/// An empty string represents an invalid output.
|
|
||||||
#[derive(Debug, Hash, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
|
|
||||||
pub struct OutputName(pub String);
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub enum Layout {
|
|
||||||
MasterStack,
|
|
||||||
Dwindle,
|
|
||||||
Spiral,
|
|
||||||
CornerTopLeft,
|
|
||||||
CornerTopRight,
|
|
||||||
CornerBottomLeft,
|
|
||||||
CornerBottomRight,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Copy, Clone, serde::Serialize)]
|
#[derive(Debug, PartialEq, Copy, Clone, serde::Serialize)]
|
||||||
pub enum AccelProfile {
|
pub enum AccelProfile {
|
||||||
Flat,
|
Flat,
|
||||||
|
@ -110,19 +77,6 @@ pub struct WindowRuleCondition {
|
||||||
tag: Option<Vec<TagId>>,
|
tag: Option<Vec<TagId>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize)]
|
|
||||||
pub enum FloatingOrTiled {
|
|
||||||
Floating,
|
|
||||||
Tiled,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub enum FullscreenOrMaximized {
|
|
||||||
Neither,
|
|
||||||
Fullscreen,
|
|
||||||
Maximized,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
|
||||||
pub struct WindowRule {
|
pub struct WindowRule {
|
||||||
/// Set the output the window will open on.
|
/// Set the output the window will open on.
|
||||||
|
@ -292,14 +246,6 @@ pub enum KeyIntOrString {
|
||||||
String(String),
|
String(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Copy, Clone, serde::Serialize, serde::Deserialize)]
|
|
||||||
pub enum Modifier {
|
|
||||||
Shift,
|
|
||||||
Ctrl,
|
|
||||||
Alt,
|
|
||||||
Super,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone)]
|
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone)]
|
||||||
pub enum Args {
|
pub enum Args {
|
||||||
/// Send a message with lines from the spawned process.
|
/// Send a message with lines from the spawned process.
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
msg::{Args, CallbackId, Msg, OutputName, Request, RequestResponse},
|
msg::{Args, CallbackId, Msg, Request, RequestResponse},
|
||||||
request, send_msg,
|
request, send_msg,
|
||||||
tag::{Tag, TagHandle},
|
tag::{Tag, TagHandle},
|
||||||
CALLBACK_VEC,
|
CALLBACK_VEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// A unique identifier for an output.
|
||||||
|
///
|
||||||
|
/// An empty string represents an invalid output.
|
||||||
|
#[derive(Debug, Hash, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
|
||||||
|
pub struct OutputName(pub String);
|
||||||
|
|
||||||
/// Output management.
|
/// Output management.
|
||||||
pub struct Output;
|
pub struct Output;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
msg::{Layout, Msg, OutputName, Request, RequestResponse, TagId},
|
msg::{Msg, Request, RequestResponse},
|
||||||
output::{Output, OutputHandle},
|
output::{Output, OutputHandle, OutputName},
|
||||||
request, send_msg,
|
request, send_msg,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -115,6 +115,13 @@ impl LayoutCycler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum TagId {
|
||||||
|
None,
|
||||||
|
#[serde(untagged)]
|
||||||
|
Some(u32),
|
||||||
|
}
|
||||||
|
|
||||||
pub struct TagHandle(pub TagId);
|
pub struct TagHandle(pub TagId);
|
||||||
|
|
||||||
pub struct TagProperties {
|
pub struct TagProperties {
|
||||||
|
@ -160,3 +167,14 @@ impl TagHandle {
|
||||||
send_msg(msg).unwrap()
|
send_msg(msg).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum Layout {
|
||||||
|
MasterStack,
|
||||||
|
Dwindle,
|
||||||
|
Spiral,
|
||||||
|
CornerTopLeft,
|
||||||
|
CornerTopRight,
|
||||||
|
CornerBottomLeft,
|
||||||
|
CornerBottomRight,
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
msg::{FullscreenOrMaximized, Msg, Request, RequestResponse, WindowId},
|
msg::{Msg, Request, RequestResponse},
|
||||||
request, send_msg,
|
request, send_msg,
|
||||||
tag::TagHandle,
|
tag::TagHandle,
|
||||||
MouseButton,
|
MouseButton,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// A unique identifier for each window.
|
||||||
|
#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum WindowId {
|
||||||
|
/// A config API returned an invalid window. It should be using this variant.
|
||||||
|
None,
|
||||||
|
/// A valid window id.
|
||||||
|
#[serde(untagged)]
|
||||||
|
Some(u32),
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Window;
|
pub struct Window;
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
|
@ -125,3 +135,16 @@ impl WindowHandle {
|
||||||
send_msg(msg).unwrap();
|
send_msg(msg).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize)]
|
||||||
|
pub enum FloatingOrTiled {
|
||||||
|
Floating,
|
||||||
|
Tiled,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
|
pub enum FullscreenOrMaximized {
|
||||||
|
Neither,
|
||||||
|
Fullscreen,
|
||||||
|
Maximized,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue