Jappie3 / wayfreeze

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

Big refactor & add cmd arguments #8

Closed Jappie3 closed 3 months ago

Jappie3 commented 3 months ago

Big refactor to avoid problems with layer surface ordering (which is up to the compositor, according to the Wayland specification). Also adds 4 new arguments:

--before-freeze-cmd <BEFORE_FREEZE_CMD>
    Command to run before freezing the screen [default: ]
--before-freeze-timeout <BEFORE_FREEZE_TIMEOUT>
    Amount of milliseconds to wait between before-freeze-cmd and freezing the screen [default: 0]
--after-freeze-cmd <AFTER_FREEZE_CMD>
    Command to run after freezing the screen [default: ]
--after-freeze-timeout <AFTER_FREEZE_TIMEOUT>
    Amount of milliseconds to wait between freezing the screen and running after-freeze-cmd [default: 0]

before-freeze allows you to run commands before Wayfreeze creates a layer surface (but after it has already copied the screen), while after-freeze is for running things after the screen has been frozen, but before Wayfreeze has exited.

Jappie3 commented 3 months ago

TODO update readme maybe some extra comments/logs

Jappie3 commented 3 months ago

@MRSS02 would appreciate a test :) tried it myself running Sway nested in Hyprland with the following arguments: --before-freeze-cmd 'grim -g "$(slurp)" -' --before-freeze-timeout 10

MRSS02 commented 3 months ago

It worked, but i had to add "; killall wayfreeze" before the evoked "before freeze" command so i don't have to click a second time to exit wayfreeze. But thanks!

Jappie3 commented 3 months ago

thanks, made sure to include killall wayfreeze in the readme