Skip to content

feature: screen freeze - #123

Merged
Decodetalkers merged 11 commits into
waycrate:masterfrom
Gigas002:feature/freeze
Jul 20, 2026
Merged

feature: screen freeze#123
Decodetalkers merged 11 commits into
waycrate:masterfrom
Gigas002:feature/freeze

Conversation

@Gigas002

Copy link
Copy Markdown
Member

This PR addes screen freeze feature via libwayshot's capabilities. The usecase for this is running wayshot -g $"(waysip -d --freeze)" -- since calling a binary on wayshot -g $"(waysip -d)" is impossible to make freezable without dirty hacks (e.g. adding waysip/slurp/etc cmd tracking on wayshot side).
I only added a minimal subset of libwayshot/image crate's features, so it does not pull lots of new deps, plus I made it completely optional.

@Gigas002
Gigas002 requested a review from Decodetalkers July 19, 2026 07:21
@Gigas002 Gigas002 self-assigned this Jul 19, 2026
@Decodetalkers

Decodetalkers commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

But libwayshot also relies on libwaysip, but with setting it optional, I think it will be fine.. Can the freeze part be induced in waysip not libwaysip? for example, add an api to set the background

we can add an callback before the capture, and there capture the output, then let libwaysip set it as the background, then the dependency won't be part of the libwaysip, but waysip instead

@Decodetalkers

Decodetalkers commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

https://github.com/waycrate/waysip/blob/master/libwaysip/src/lib.rs#L263-L280

we can add a callback field here to Waysip, for example

Box<dyn Fn(&wl_output::WlOutput) -> Option<cairo::Surface> + 'static>

and this will add an extra background for it. Then we can move the logic to the waysip not libwaysip

@Gigas002

Copy link
Copy Markdown
Member Author

@Decodetalkers
Thanks. Yes, I think this is a better approach than my previous one. Refactored the code.
Also we have to temprorarily depend on libdrm and mesa for libwayshot in CI until we push new crate version, so we won't have to use gbm/drm in waysip later

Comment thread waysip/src/freeze.rs

use std::collections::HashMap;

use wayland_client::protocol::wl_output::WlOutput;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think libwayshot has already reexported the WlOutput, we can use that directly

Comment thread waysip/src/freeze.rs
/// screenshot backend itself couldn't be initialised.
pub fn capture_backgrounds()
-> Option<impl Fn(&WlOutput, &str) -> Option<cairo::ImageSurface> + 'static> {
let wayshot_conn = match libwayshot::WayshotConnection::new() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should let waysip and libwayshot use the same connection, then you do not need to find them again

@Decodetalkers

Copy link
Copy Markdown
Collaborator

after modified libwayshot, I make this patch

Decodetalkers@74ad6d5

This is what I have changed based on this pr

@Decodetalkers

Copy link
Copy Markdown
Collaborator

maybe your is better.. Emm..mime created wayshot connection for too many times.. Maybe we can let wayshot connection implement Clone. create new queue, and clone all the registered things

@Decodetalkers Decodetalkers left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should admit yours is better, LGTM

@Decodetalkers

Copy link
Copy Markdown
Collaborator

I think it is fine, let me merge it

@Decodetalkers
Decodetalkers merged commit 089cd4e into waycrate:master Jul 20, 2026
8 checks passed
@Gigas002

Copy link
Copy Markdown
Member Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants