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",
|
||||||
"crates/popcorn-d",
|
"crates/popcorn-d",
|
||||||
"crates/popcorn-conf",
|
"crates/popcorn-conf",
|
||||||
|
"crates/popcorn-proto",
|
||||||
]
|
]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
@ -11,4 +12,4 @@ lto = "thin"
|
|||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
strip = "symbols"
|
strip = "symbols"
|
||||||
opt-level = "z"
|
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"
|
toml = "0.9.8"
|
||||||
popcorn-conf = { path = "../popcorn-conf" }
|
popcorn-conf = { path = "../popcorn-conf" }
|
||||||
serde = { version = "1.0.228", features = ["derive"] }
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
|
popcorn-proto = { path = "../popcorn-proto" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
slint-build = "1.14.1"
|
slint-build = "1.14.1"
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
use popcorn_conf::PopcornConfig;
|
use popcorn_conf::PopcornConfig;
|
||||||
|
use popcorn_proto::OsdArgs;
|
||||||
|
|
||||||
use i_slint_backend_winit::{
|
use i_slint_backend_winit::{
|
||||||
Backend,
|
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 {
|
pub struct OsdUi {
|
||||||
ui: OSDpopup,
|
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+"
|
license = "GPL-3+"
|
||||||
|
|
||||||
[dependencies]
|
[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 clap::{Parser, ValueHint};
|
||||||
|
use popcorn_proto::OsdArgs;
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(
|
#[command(
|
||||||
@ -37,12 +38,6 @@ pub struct CliArgs {
|
|||||||
pub color: Option<String>,
|
pub color: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct OsdArgs {
|
|
||||||
pub value: Option<u8>,
|
|
||||||
pub icon: Option<String>,
|
|
||||||
pub color: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<CliArgs> for OsdArgs {
|
impl From<CliArgs> for OsdArgs {
|
||||||
fn from(c: CliArgs) -> Self {
|
fn from(c: CliArgs) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
mod args;
|
mod args;
|
||||||
|
|
||||||
use args::{CliArgs, OsdArgs};
|
use args::CliArgs;
|
||||||
|
use popcorn_proto::OsdArgs;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user