autocommit 2022-02-17 19:12:52 CET
This commit is contained in:
parent
cf322f05be
commit
195a92d98b
29 changed files with 610 additions and 175 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use crate::_private::ipc::{ClientMessage, InitMessage, Response, ServerMessage};
|
||||
use crate::_private::{bincode_ops, logging, Config, ConfigEntry, ConfigEntryGen, VERSION};
|
||||
use crate::keyboard::keymap::Keymap;
|
||||
use crate::theme::Color;
|
||||
use crate::{Axis, Command, Direction, InputDevice, Keyboard, LogLevel, ModifiedKeySym, Seat};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::hash_map::Entry;
|
||||
|
|
@ -195,10 +196,60 @@ impl Client {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_title_color(&self, color: Color) {
|
||||
self.send(&ClientMessage::SetTitleColor { color });
|
||||
}
|
||||
|
||||
pub fn set_border_color(&self, color: Color) {
|
||||
self.send(&ClientMessage::SetBorderColor { color });
|
||||
}
|
||||
|
||||
pub fn set_title_underline_color(&self, color: Color) {
|
||||
self.send(&ClientMessage::SetTitleUnderlineColor { color });
|
||||
}
|
||||
|
||||
pub fn set_background_color(&self, color: Color) {
|
||||
self.send(&ClientMessage::SetBackgroundColor { color });
|
||||
}
|
||||
|
||||
pub fn get_title_height(&self) -> i32 {
|
||||
let resp = self.with_response(|| self.send(&ClientMessage::GetTitleHeight));
|
||||
match resp {
|
||||
Response::GetTitleHeight { height } => height,
|
||||
_ => {
|
||||
log::warn!("Server did not reply to a get_title_height request");
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_border_width(&self) -> i32 {
|
||||
let resp = self.with_response(|| self.send(&ClientMessage::GetBorderWidth));
|
||||
match resp {
|
||||
Response::GetBorderWidth { width } => width,
|
||||
_ => {
|
||||
log::warn!("Server did not reply to a get_border_width request");
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_title_height(&self, height: i32) {
|
||||
self.send(&ClientMessage::SetTitleHeight { height })
|
||||
}
|
||||
|
||||
pub fn set_border_width(&self, width: i32) {
|
||||
self.send(&ClientMessage::SetBorderWidth { width })
|
||||
}
|
||||
|
||||
pub fn set_split(&self, seat: Seat, axis: Axis) {
|
||||
self.send(&ClientMessage::SetSplit { seat, axis });
|
||||
}
|
||||
|
||||
pub fn create_split(&self, seat: Seat, axis: Axis) {
|
||||
self.send(&ClientMessage::CreateSplit { seat, axis });
|
||||
}
|
||||
|
||||
pub fn create_seat(&self, name: &str) -> Seat {
|
||||
let response = self.with_response(|| self.send(&ClientMessage::CreateSeat { name }));
|
||||
match response {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::keyboard::keymap::Keymap;
|
||||
use crate::keyboard::mods::Modifiers;
|
||||
use crate::keyboard::syms::KeySym;
|
||||
use crate::theme::Color;
|
||||
use crate::{Axis, Direction, InputDevice, Keyboard, LogLevel, Seat};
|
||||
use bincode::{BorrowDecode, Decode, Encode};
|
||||
|
||||
|
|
@ -94,6 +95,30 @@ pub enum ClientMessage<'a> {
|
|||
kb: Keyboard,
|
||||
grab: bool,
|
||||
},
|
||||
GetTitleHeight,
|
||||
GetBorderWidth,
|
||||
SetTitleHeight {
|
||||
height: i32,
|
||||
},
|
||||
SetBorderWidth {
|
||||
width: i32,
|
||||
},
|
||||
SetTitleColor {
|
||||
color: Color,
|
||||
},
|
||||
SetTitleUnderlineColor {
|
||||
color: Color,
|
||||
},
|
||||
SetBorderColor {
|
||||
color: Color,
|
||||
},
|
||||
SetBackgroundColor {
|
||||
color: Color,
|
||||
},
|
||||
CreateSplit {
|
||||
seat: Seat,
|
||||
axis: Axis,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Debug)]
|
||||
|
|
@ -105,6 +130,8 @@ pub enum Response {
|
|||
ParseKeymap { keymap: Keymap },
|
||||
CreateSeat { seat: Seat },
|
||||
GetInputDevices { devices: Vec<InputDevice> },
|
||||
GetTitleHeight { height: i32 },
|
||||
GetBorderWidth { width: i32 },
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Debug)]
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ use std::collections::HashMap;
|
|||
mod macros;
|
||||
#[doc(hidden)]
|
||||
pub mod _private;
|
||||
pub mod keyboard;
|
||||
pub mod embedded;
|
||||
pub mod keyboard;
|
||||
pub mod theme;
|
||||
|
||||
#[derive(Encode, Decode, Copy, Clone, Debug)]
|
||||
pub enum LogLevel {
|
||||
|
|
@ -129,6 +130,10 @@ impl Seat {
|
|||
(|| res = get!().get_input_devices(Some(self)))();
|
||||
res
|
||||
}
|
||||
|
||||
pub fn create_split(self, axis: Axis) {
|
||||
get!().create_split(self, axis);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_seats() -> Vec<Seat> {
|
||||
|
|
|
|||
45
i4config/src/theme.rs
Normal file
45
i4config/src/theme.rs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
use bincode::{BorrowDecode, Encode};
|
||||
|
||||
#[derive(Encode, BorrowDecode, Debug)]
|
||||
pub struct Color {
|
||||
pub r: u8,
|
||||
pub g: u8,
|
||||
pub b: u8,
|
||||
pub a: u8,
|
||||
}
|
||||
|
||||
pub fn set_title_color(color: Color) {
|
||||
get!().set_title_color(color)
|
||||
}
|
||||
|
||||
pub fn set_title_underline_color(color: Color) {
|
||||
get!().set_title_underline_color(color)
|
||||
}
|
||||
|
||||
pub fn set_border_color(color: Color) {
|
||||
get!().set_border_color(color)
|
||||
}
|
||||
|
||||
pub fn set_background_color(color: Color) {
|
||||
get!().set_background_color(color)
|
||||
}
|
||||
|
||||
pub fn get_title_height() -> i32 {
|
||||
let mut res = 0;
|
||||
(|| res = get!().get_title_height())();
|
||||
res
|
||||
}
|
||||
|
||||
pub fn get_border_width() -> i32 {
|
||||
let mut res = 0;
|
||||
(|| res = get!().get_border_width())();
|
||||
res
|
||||
}
|
||||
|
||||
pub fn set_title_height(height: i32) {
|
||||
get!().set_title_height(height)
|
||||
}
|
||||
|
||||
pub fn set_border_width(width: i32) {
|
||||
get!().set_border_width(width)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue