Skip to content

Commit

Permalink
fix: move specific deps to linux deps
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRibera committed Jan 12, 2024
1 parent bf7a072 commit 1d66427
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-dar
publish-jobs = ["homebrew"]
# Publish jobs to run in CI
pr-run-mode = "skip"

[workspace.metadata.dist.dependencies.apt]
libxcb1 = "*"
libxrandr2 = "*"
libdbus-1-3 = "*"
4 changes: 3 additions & 1 deletion crates/sss_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ eula = false

[dependencies]
clap.workspace = true
libwayshot = "0.3.0"
screenshots = "0.8.6"
sss_lib = { path = "../sss_lib" }

[target.x86_64-unknown-linux-gnu.dependencies]
libwayshot = "0.3.0"
14 changes: 14 additions & 0 deletions crates/sss_cli/src/shot.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use std::env::var_os;

#[cfg(target_os = "linux")]
use libwayshot::output::OutputPositioning;
#[cfg(target_os = "linux")]
use libwayshot::reexport::Transform;
#[cfg(target_os = "linux")]
use libwayshot::{CaptureRegion, WayshotConnection};
use screenshots::display_info::DisplayInfo;
use screenshots::image::imageops::{overlay, rotate180, rotate270, rotate90};
Expand Down Expand Up @@ -56,9 +59,12 @@ impl Default for ShotImpl {
fn default() -> Self {
Self {
xorg: (!wayland_detect()).then_some(Screen::all().unwrap()),
#[cfg(target_os = "linux")]
wayland: wayland_detect()
.then_some(WayshotConnection::new())
.map(|w| w.unwrap()),
#[cfg(not(target_os = "linux"))]
wayland: None,
}
}
}
Expand Down Expand Up @@ -86,6 +92,10 @@ impl ShotImpl {
));
}

#[cfg(not(target_os = "linux"))]
return Err("No Context loaded".to_string());

#[cfg(target_os = "linux")]
self.wayland
.as_ref()
.ok_or("No Context loaded".to_string())
Expand Down Expand Up @@ -152,6 +162,10 @@ impl ShotImpl {
.unwrap());
}

#[cfg(not(target_os = "linux"))]
return Err("No Context loaded".to_string());

#[cfg(target_os = "linux")]
self.wayland
.as_ref()
.ok_or("No Context loaded".to_string())
Expand Down

0 comments on commit 1d66427

Please sign in to comment.