Move OsdArgs to shared crate popcorn-proto
- Avoid duplication - Improve extensibility
This commit is contained in:
parent
13fe01a7d9
commit
8959cce9f9
@ -4,6 +4,7 @@ members = [
|
||||
"crates/popcorn",
|
||||
"crates/popcorn-d",
|
||||
"crates/popcorn-conf",
|
||||
"crates/popcorn-proto",
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
@ -11,4 +12,4 @@ lto = "thin"
|
||||
codegen-units = 1
|
||||
strip = "symbols"
|
||||
opt-level = "z"
|
||||
panic = "abort"
|
||||
panic = "abort"
|
||||
|
||||
@ -20,6 +20,7 @@ slint = { version = "1.14.1", default-features = false, features = ["backend-win
|
||||
toml = "0.9.8"
|
||||
popcorn-conf = { path = "../popcorn-conf" }
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
popcorn-proto = { path = "../popcorn-proto" }
|
||||
|
||||
[build-dependencies]
|
||||
slint-build = "1.14.1"
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
use popcorn_conf::PopcornConfig;
|
||||
use popcorn_proto::OsdArgs;
|
||||
|
||||
use i_slint_backend_winit::{
|
||||
Backend,
|
||||
@ -22,12 +23,6 @@ fn parse_hex_color(s: &str) -> Result<Color, String> {
|
||||
}
|
||||
}
|
||||
|
||||
struct OsdArgs {
|
||||
value: Option<u8>,
|
||||
icon: Option<String>,
|
||||
color: Option<String>,
|
||||
}
|
||||
|
||||
pub struct OsdUi {
|
||||
ui: OSDpopup,
|
||||
}
|
||||
|
||||
7
crates/popcorn-proto/Cargo.toml
Normal file
7
crates/popcorn-proto/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "popcorn-proto"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
10
crates/popcorn-proto/src/lib.rs
Normal file
10
crates/popcorn-proto/src/lib.rs
Normal file
@ -0,0 +1,10 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// Protocol stuff for IPC comm
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct OsdArgs {
|
||||
pub value: Option<u8>,
|
||||
pub icon: Option<String>,
|
||||
pub color: Option<String>,
|
||||
}
|
||||
@ -12,4 +12,5 @@ keywords = ["OSD", "popup", "desktop", "cli"]
|
||||
license = "GPL-3+"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.53", features = ["derive"] }
|
||||
clap = { version = "4.5.53", features = ["derive"] }
|
||||
popcorn-proto = { path = "../popcorn-proto" }
|
||||
@ -1,4 +1,5 @@
|
||||
use clap::{Parser, ValueHint};
|
||||
use popcorn_proto::OsdArgs;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(
|
||||
@ -37,12 +38,6 @@ pub struct CliArgs {
|
||||
pub color: Option<String>,
|
||||
}
|
||||
|
||||
pub struct OsdArgs {
|
||||
pub value: Option<u8>,
|
||||
pub icon: Option<String>,
|
||||
pub color: Option<String>,
|
||||
}
|
||||
|
||||
impl From<CliArgs> for OsdArgs {
|
||||
fn from(c: CliArgs) -> Self {
|
||||
Self {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
mod args;
|
||||
|
||||
use args::{CliArgs, OsdArgs};
|
||||
use args::CliArgs;
|
||||
use popcorn_proto::OsdArgs;
|
||||
use clap::Parser;
|
||||
|
||||
fn main() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user