Jappie3 / wayfreeze

Tool to freeze the screen of a Wayland compositor
GNU Affero General Public License v3.0
19 stars 1 forks source link

Does not work in Sway / SwayFX #6

Closed MRSS02 closed 2 months ago

MRSS02 commented 2 months ago

Hello,

I compiled this tool and the ran it, however when doing so the screen didn't freeze

I'm using SwayFX, version swayfx version 0.4-ac19df1 (Jul 18 2024, branch 'master') (based on sway 1.9.0), with an amd radeon rx 6400 gpu,

Jappie3 commented 2 months ago

Hi, thanks for the report. Could you clone the repo, run RUST_LOG=debug cargo run & paste the log here?

MRSS02 commented 2 months ago
   Compiling proc-macro2 v1.0.78
   Compiling unicode-ident v1.0.12
   Compiling cfg-if v1.0.0
   Compiling log v0.4.20
   Compiling pkg-config v0.3.30
   Compiling rustix v0.38.31
   Compiling cc v1.0.87
   Compiling linux-raw-sys v0.4.13
   Compiling bitflags v2.4.2
   Compiling memchr v2.7.1
   Compiling smallvec v1.13.1
   Compiling utf8parse v0.2.1
   Compiling downcast-rs v1.2.0
   Compiling scoped-tls v1.0.1
   Compiling regex-syntax v0.8.2
   Compiling libloading v0.8.1
   Compiling anstyle-parse v0.2.3
   Compiling anstyle-query v1.0.2
   Compiling colorchoice v1.0.0
   Compiling libc v0.2.153
   Compiling anstyle v1.0.6
   Compiling io-lifetimes v2.0.3
   Compiling dlib v0.5.2
   Compiling strsim v0.11.0
   Compiling heck v0.5.0
   Compiling clap_lex v0.7.0
   Compiling humantime v2.1.0
   Compiling fastrand v2.0.1
   Compiling anstream v0.6.13
   Compiling xkeysym v0.2.0
   Compiling argparse v0.2.2
   Compiling clap_builder v4.5.2
   Compiling wayland-sys v0.31.1
   Compiling quick-xml v0.31.0
   Compiling aho-corasick v1.1.2
   Compiling quote v1.0.35
   Compiling syn v2.0.53
   Compiling wayland-backend v0.3.3
   Compiling memmap2 v0.8.0
   Compiling wayland-scanner v0.31.1
   Compiling xkbcommon v0.7.0
   Compiling regex-automata v0.4.5
   Compiling clap_derive v4.5.3
   Compiling regex v1.10.3
   Compiling env_filter v0.1.0
   Compiling env_logger v0.11.2
   Compiling tempfile v3.10.0
   Compiling wayland-client v0.31.2
   Compiling wayland-server v0.31.1
   Compiling clap v4.5.3
   Compiling wayland-protocols v0.31.2
   Compiling wayland-protocols-wlr v0.2.0
   Compiling wayfreeze v0.1.0 (/home/mparagames/wayfreeze)
    Finished dev [unoptimized + debuginfo] target(s) in 6.28s
     Running `target/debug/wayfreeze`
[2024-07-24T04:45:10Z INFO  wayfreeze] > Parsed arguments
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wl_shm v1
[2024-07-24T04:45:10Z INFO  wayfreeze] > Bound: wl_shm v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wl_drm v2
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_linux_dmabuf_v1 v4
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wl_compositor v6
[2024-07-24T04:45:10Z INFO  wayfreeze] > Bound: wl_compositor v6
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wl_subcompositor v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wl_data_device_manager v3
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_gamma_control_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zxdg_output_manager_v1 v3
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: ext_idle_notifier_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_idle_inhibit_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_layer_shell_v1 v4
[2024-07-24T04:45:10Z INFO  wayfreeze] > Bound: zwlr_layer_shell_v1 v4
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: xdg_wm_base v2
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_tablet_manager_v2 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: org_kde_kwin_server_decoration_manager v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zxdg_decoration_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_relative_pointer_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_pointer_constraints_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wp_presentation v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_output_manager_v1 v4
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_output_power_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_input_method_manager_v2 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_text_input_manager_v3 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_foreign_toplevel_manager_v1 v3
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: ext_session_lock_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wp_drm_lease_device_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_export_dmabuf_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_screencopy_manager_v1 v3
[2024-07-24T04:45:10Z INFO  wayfreeze] > Bound: zwlr_screencopy_manager_v1 v3
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_data_control_manager_v1 v2
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wp_security_context_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wp_viewporter v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wp_single_pixel_buffer_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wp_content_type_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wp_fractional_scale_manager_v1 v1
[2024-07-24T04:45:10Z INFO  wayfreeze] > Bound: wp_fractional_scale_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zxdg_exporter_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zxdg_importer_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zxdg_exporter_v2 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zxdg_importer_v2 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: xdg_activation_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wp_cursor_shape_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_virtual_keyboard_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_virtual_pointer_manager_v1 v2
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwlr_input_inhibit_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_keyboard_shortcuts_inhibit_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_pointer_gestures_v1 v3
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wl_seat v8
[2024-07-24T04:45:10Z INFO  wayfreeze] > Bound: wl_seat v8
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: zwp_primary_selection_device_manager_v1 v1
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_registry::Event::Global: wl_output v4
[2024-07-24T04:45:10Z INFO  wayfreeze] > Bound: wl_output v4
[2024-07-24T04:45:10Z INFO  wayfreeze] > Received all globals
[2024-07-24T04:45:10Z INFO  wayfreeze] > Bound to 1 input(s)
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_keyboard::Event::Keymap
[2024-07-24T04:45:10Z DEBUG wayfreeze] | Received wl_output::Event::Mode for output 0
Jappie3 commented 2 months ago

thanks! should be fixed in cb46af95bf790bd32d4e09ee633261b7d3590735

Jappie3 commented 2 months ago

(git pull & try again)

MRSS02 commented 2 months ago

Thanks for the support!

However, now the application crashes with this error after the update:

image

Jappie3 commented 2 months ago

ok try again, should be working now (tested in nested Sway running on Hyprland)

MRSS02 commented 2 months ago

Hi! So uh, now it runs, however when running alongside grim + slurp, it activates before it and not at the same time, so it freezes before grim+slurp even starts, so no screen dim from it, and then clicking the screen once kills wayfreeze and starts grim+slurp with the screen unfreezed. Even when using your example usage command, this still happens.

Jappie3 commented 2 months ago

I think this is due to how Sway implements the wlr-layer-shell protocol compared to Hyprland, the protocol states the following:

Multiple surfaces can share a single layer, and ordering within a single layer is undefined.

so the compositor can choose the ordering, and Sway puts the Wayfreeze layer under Grim & Slurp...

Can you try this command? If you don't want to see the Slurp cursor when the screen is frozen, use wayfreeze --hide-cursor. I'll update the readme if it works on your end too

$(grim -g "$(slurp)" - | wl-copy; killall wayfreeze) & sleep .1; wayfreeze
MRSS02 commented 2 months ago

Oooh, this works!

Sorry for the delay in answering though. But yeah, it now runs both at once, as intended. Thank you!

Jappie3 commented 2 months ago

Glad to hear that! I'll add the Sway example command to the readme.

Jappie3 commented 2 months ago

296cec081b4d977c481a49dbf246b7a17b8c82d1

MRSS02 commented 1 month ago

Oh, sorry to reopen this issue but like, i started noticing afterwards that for some reason with a command like that, sometimes it is evoking the grim dim screen effect twice, which makes the screenshots also contain that dim. Can this be solved?

https://github.com/user-attachments/assets/fb159b45-a42f-4cb8-b937-efdbbfb2fb89