Skip to content

Commit

Permalink
Add support for wlr-screencopy-unstable-v1 protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
maximbaz committed Oct 23, 2024
1 parent 064f253 commit 96680d7
Show file tree
Hide file tree
Showing 6 changed files with 480 additions and 96 deletions.
9 changes: 8 additions & 1 deletion src/config/app.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
use std::collections::HashMap;

#[derive(Debug, Clone, PartialEq)]
pub enum WaylandProtocol {
Any,
WlrScreencopyUnstableV1,
WlrExportDmabufUnstableV1,
}

#[derive(Debug, Clone)]
pub enum Capturer {
WlrExportDmabufUnstableV1,
Wayland(WaylandProtocol),
None,
}

Expand Down
4 changes: 3 additions & 1 deletion src/config/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use std::collections::HashMap;
#[derive(Deserialize, Debug)]
pub enum Capturer {
#[serde(rename = "wlroots")]
DeprecatedWlrExportDmabufUnstableV1,
Wlroots,
#[serde(rename = "wlr-export-dmabuf-unstable-v1")]
WlrExportDmabufUnstableV1,
#[serde(rename = "wlr-screencopy-unstable-v1")]
WlrScreencopyUnstableV1,
#[serde(rename = "none")]
None,
}
Expand Down
24 changes: 14 additions & 10 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ fn parse() -> Result<app::Config, toml::de::Error> {
min_brightness: 1,
capturer: match o.capturer {
file::Capturer::None => app::Capturer::None,
file::Capturer::WlrExportDmabufUnstableV1 => {
app::Capturer::WlrExportDmabufUnstableV1
file::Capturer::Wlroots => {
app::Capturer::Wayland(app::WaylandProtocol::Any)
}
file::Capturer::WlrScreencopyUnstableV1 => {
app::Capturer::Wayland(app::WaylandProtocol::WlrScreencopyUnstableV1)
}
file::Capturer::DeprecatedWlrExportDmabufUnstableV1 => {
log::warn!("capturer=\"wlroots\" is deprecated by capturer=\"wlr-export-dmabuf-unstable-v1\"");
app::Capturer::WlrExportDmabufUnstableV1
file::Capturer::WlrExportDmabufUnstableV1 => {
app::Capturer::Wayland(app::WaylandProtocol::WlrExportDmabufUnstableV1)
}
},
})
Expand All @@ -51,12 +53,14 @@ fn parse() -> Result<app::Config, toml::de::Error> {
min_brightness: 1,
capturer: match o.capturer {
file::Capturer::None => app::Capturer::None,
file::Capturer::WlrExportDmabufUnstableV1 => {
app::Capturer::WlrExportDmabufUnstableV1
file::Capturer::Wlroots => {
app::Capturer::Wayland(app::WaylandProtocol::Any)
}
file::Capturer::WlrScreencopyUnstableV1 => {
app::Capturer::Wayland(app::WaylandProtocol::WlrScreencopyUnstableV1)
}
file::Capturer::DeprecatedWlrExportDmabufUnstableV1 => {
log::warn!("capturer=\"wlroots\" is deprecated by capturer=\"wlr-export-dmabuf-unstable-v1\"");
app::Capturer::WlrExportDmabufUnstableV1
file::Capturer::WlrExportDmabufUnstableV1 => {
app::Capturer::Wayland(app::WaylandProtocol::WlrExportDmabufUnstableV1)
}
},
})
Expand Down
Loading

0 comments on commit 96680d7

Please sign in to comment.