hyprlock icon indicating copy to clipboard operation
hyprlock copied to clipboard

core: use a screenshot for fade in/out

Open PointerDilemma opened this issue 8 months ago • 1 comments

Instead of relying on Hyprland drawing it's workspaces when locked, use a screenshot to fade in and out.

Basically had to rewrite the background widget. No merging yet. I might revision the background widget.

Needs testing.

Note: This is supposed to go together with a MR that makes it so Hyprland does not draw workspaces when locked per default. But I have a misc:allow_session_lock_xray setting planed to keep it possible to use shape:xray or implement dynamic blur.

PointerDilemma avatar Mar 31 '25 18:03 PointerDilemma

just tested for ya.

This helps a lot with the fade in animation. Previously it wouldn't work on my main monitor (maybe it did, but the fade looked like it was instant)

with this change the transition is a lot smoother. Thanks!

fxzzi avatar Apr 16 '25 18:04 fxzzi

I also tested the reload_cmd and such. I think this is ready.

One thing I didn't mention yet: With this, the crossfade of the background can be configured with the fadeIn animation config, because it uses the same code as the fade in from screenshot the the inital background. Should probably be it's own animation config in the future.

PointerDilemma avatar Jun 13 '25 11:06 PointerDilemma

Most of it comes from the Background widget. It didn't make any sense to me to jank this feature on top of the existing background cross fade and reload code.

Thanks for reviewing and testing though. Merging :train2:

PointerDilemma avatar Jun 22 '25 07:06 PointerDilemma

Hey @PaideiaDilemma :) This commit has introduced a problem with hyprlands permission system for me. Every time I launch hyprlock now this permission dialog pops up image This also happens after explicitly allowing the screencopy for hyprlock in my hyprland.conf permission=/nix/store/aqr1ya8vy6zbx3slbx547hvldwdh2c70-hyprlock-0.8.2+date=2025-06-22_a963898/bin/hyprlock, screencopy, allow Setting permission=.*, screencopy, allow does fix the issue but it is something that I would rather avoid :sweat_smile: The current behaviour causes my hyprlock to not display my lock screen wallpaper (before interacting with the popup) leaving everything on the screens visible.

leon-erd avatar Jun 26 '25 12:06 leon-erd

or just set the permission for hyprlock's binary only. rtfm: https://wiki.hypr.land/Configuring/Permissions/#notes

vaxerski avatar Jun 26 '25 17:06 vaxerski

@vaxerski huh wdym? As stated above setting the following does nothing... :thinking: permission=/nix/store/aqr1ya8vy6zbx3slbx547hvldwdh2c70-hyprlock-0.8.2+date=2025-06-22_a963898/bin/hyprlock, screencopy, allow

leon-erd avatar Jun 26 '25 18:06 leon-erd

because it's not valid regex probably. The first parameter is a regex, not a path. The link I sent outlines a regex for nix.

vaxerski avatar Jun 26 '25 18:06 vaxerski

I have set this in nix as per the wiki

    permission = [
      "${lib.getExe config.programs.hyprlock.package}, screencopy, allow"
    ];

This just expands to the line I posted. Doing the same for grim etc works no problem. Could it be that internally hyprlock is spawning a different process to capture the screen which is not allowed by the rule?

Anyways I will try the regex from the wiki just to be sure

leon-erd avatar Jun 26 '25 18:06 leon-erd

@fufexan that example is wrong, it will break if you have any funky regex characters in the path. Can you nuke it?

vaxerski avatar Jun 26 '25 18:06 vaxerski

Ahhh I see what the problem is!! Characters with special meaning for regex (e.g. +) are not escaped and therefore the regex doesn't match the string. Makes total sense now :grinning: Nix has a function for this. I will submit a PR for the wiki making use of this :))

leon-erd avatar Jun 26 '25 19:06 leon-erd

Damn, forgot we have + in some version strings.

fufexan avatar Jun 26 '25 19:06 fufexan