chaosparrot / talon_hud

Unofficial Talon Head Up Display scripts
68 stars 29 forks source link

Feature request: way to quickly show/hide all overlays without animation #28

Closed wolfmanstout closed 2 years ago

wolfmanstout commented 2 years ago

I'd like to have a way to quickly hide all the overlays while I take a screenshot and then restore them. I tried doing this in display.py by iterating through all the widgets in HeadUpDisplay.widget_manager and calling canvas.hide/show, but it turns out there are other overlays that are unaffected (e.g. the ones activated via hud_publish_screen_regions).

Is this an action you could add, or give me a pointer to how I might implement this for all the overlays?

chaosparrot commented 2 years ago

I kind of liked watermarking peoples screenshots with the HUD, but I get why you would want to disable it temporarily.

I added an action to display.py ( hud_set_visibility ) where you can hide or show all the canvases without it affecting enabled statuses, the content flow or anything, as regular hiding actually removes the canvases entirely.

I also added a short time delay in it, to make sure that you can use it in a talon file and be sure the screen is clear after the action finishes, I've tested this with this talon command:

screenshot this:
    user.hud_set_visibility(0)
    key(printscr)
    user.hud_set_visibility(1)

And confirmed the screenshot was clean of HUD elements.

I didn't add a default voice command for it, as I figured it would be hard to explain the distinction between 'hidden' and 'invisible' without majorly confusing users.

wolfmanstout commented 2 years ago

Awesome, thank you!

I like the idea of watermarking but my use case of OCR really benefits from a clean screenshot. In case you are curious: https://github.com/wolfmanstout/talon-gaze-ocr

wolfmanstout commented 2 years ago

Would you be open to adding an optional parameter pause_seconds=0.05 to the new action to specify sleep? 100 ms total is a visible hit on my most frequently used commands, and experimentally I found that 0.01 pause was enough on both of my (fast) computers (Windows and Mac).

Thank you for implementing this so quickly, it works really well!

chaosparrot commented 2 years ago

I added the suggestion for pause_seconds to the latest master commit, so you should be able to set it now :)