Skip to content

Commit

Permalink
chore: remove deps in lib for libwayshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Oct 6, 2023
1 parent b5ea00e commit daf5eed
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion libs/screenshotdialog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"

[dependencies]
slint = "1.2.1"
libwayshot = { git = "https://github.com/waycrate/wayshot.git" }

[build-dependencies]
slint-build = "1.2.1"
16 changes: 2 additions & 14 deletions libs/screenshotdialog/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::rc::Rc;

use libwayshot::output::OutputInfo;
use slint::VecModel;
slint::include_modules!();

Expand Down Expand Up @@ -32,20 +31,9 @@ fn init_slots(ui: &AppWindow, sender: mpsc::Sender<SlintSelection>) {
});
}

pub fn selectgui(screen: Vec<OutputInfo>) -> SlintSelection {
pub fn selectgui(screen: Vec<ScreenInfo>) -> SlintSelection {
let ui = AppWindow::new().unwrap();
ui.set_infos(
Rc::new(VecModel::from(
screen
.iter()
.map(|screen| ScreenInfo {
name: screen.name.clone().into(),
description: screen.description.clone().into(),
})
.collect::<Vec<ScreenInfo>>(),
))
.into(),
);
ui.set_infos(Rc::new(VecModel::from(screen)).into());
let (sender, receiver) = mpsc::channel();
init_slots(&ui, sender);
ui.run().unwrap();
Expand Down
11 changes: 9 additions & 2 deletions src/screenshot.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use libwayshot::WayshotConnection;
use screenshotdialog::ScreenInfo;
use screenshotdialog::SlintSelection;
use std::collections::HashMap;
use zbus::zvariant::{DeserializeDict, SerializeDict, Type, Value};
Expand Down Expand Up @@ -53,8 +54,14 @@ impl ScreenShotBackend {
})?
.get_all_outputs()
.clone();

match screenshotdialog::selectgui(wayinfos.clone()) {
let screen_infos = wayinfos
.iter()
.map(|screen| ScreenInfo {
name: screen.name.clone().into(),
description: screen.description.clone().into(),
})
.collect();
match screenshotdialog::selectgui(screen_infos) {
SlintSelection::Canceled => return Ok(PortalResponse::Cancelled),
SlintSelection::Slurp => {
let slurp = std::process::Command::new("slurp")
Expand Down

0 comments on commit daf5eed

Please sign in to comment.