picom icon indicating copy to clipboard operation
picom copied to clipboard

Add foreground blurring (Privacy and Focus modes)

Open dshoreman opened this issue 2 years ago • 7 comments

Continuation/revival of #490 by @rajansaini691; see that PR for more background.

Differences in this PR:

  • Dropped merge commit, squashed formatting fixes
  • Rebased onto latest next branch, resolved conflicts
  • Added --inactive-blur-include option (see below)
  • Added --inactive-blur-opacity
  • Utilised the blur_foreground property (added but unused in original PR)
  • Avoids blurring background and foreground of the same window to boost speed

Option Rationale

Comments in the original PR called for an exclusion list to be added, but I couldn't see how that would be useful so opted for the inverse.
Doing it this way allows for two different behaviours - either "privacy" or "focus" mode.

  1. Focus Mode The easiest option, this will blur all inactive windows:

    inactive-blur = true;
    
  2. Privacy Mode Combining both options will only blur windows defined in --inactive-blur-list.
    This can be useful for hiding sensitive data, eg communication or banking apps:

    inactive-blur = true;
    inactive-blur-include = [
        "class_g = 'discord'",
        "name *= '- Gmail -'",
        "class_g = 'Signal'",
        "class_g = 'TelegramDesktop'",
    ];
    

Closes #489

dshoreman avatar Jan 23 '22 16:01 dshoreman

Codecov Report

Merging #765 (cda8ca4) into next (05ef18d) will increase coverage by 1.28%. The diff coverage is 36.00%.

:exclamation: Current head cda8ca4 differs from pull request most recent head 45dc995. Consider uploading reports for the commit 45dc995 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #765      +/-   ##
==========================================
+ Coverage   37.74%   39.02%   +1.28%     
==========================================
  Files          48       46       -2     
  Lines       10869     9681    -1188     
==========================================
- Hits         4102     3778     -324     
+ Misses       6767     5903     -864     
Impacted Files Coverage Δ
src/config.c 42.74% <ø> (-8.53%) :arrow_down:
src/config.h 23.52% <ø> (ø)
src/options.c 21.09% <0.00%> (+1.89%) :arrow_up:
src/render.c 4.08% <0.00%> (+2.77%) :arrow_up:
src/win.h 78.12% <ø> (ø)
src/config_libconfig.c 58.09% <25.00%> (+0.53%) :arrow_up:
src/backend/backend.c 62.27% <33.33%> (+2.59%) :arrow_up:
src/win.c 68.15% <80.00%> (+1.01%) :arrow_up:
src/picom.c 67.80% <100.00%> (+1.91%) :arrow_up:

... and 27 files with indirect coverage changes

codecov[bot] avatar Jan 23 '22 16:01 codecov[bot]

Thanks for the PR! This is great work, I like how small the changes are for what it does.

Thanks! I can't take all the credit though.
Much of the work is by @rajansaini691—I simply rebased and made some minor behavioural changes ;)

Sorry it took so long to fix the style issue, a few things came up all at once IRL. I'll see what I can do to resolve any issues later.
It'd be nice to add a test or two as well but so far I haven't even looked inside the tests dir, so we'll see

dshoreman avatar Feb 10 '22 15:02 dshoreman

Hi, looking for an update on this, does this PR have a future? I'm looking for this feature for quite a while and it's kind of disheartening to see this PR and its predecessor be practically dead.

schrottkatze avatar Sep 19 '22 11:09 schrottkatze

Hi Gabriel, I stopped work on this PR since I temporarily stopped using Linux altogether for unrelated reasons. However, like my successor said, it shouldn't be too much work to integrate my changes. Hope someone can pick it up again and take focus mode to production! :)

On Mon, Sep 19, 2022, 4:40 AM Gabriel @.***> wrote:

Hi, looking for an update on this, does this PR have a future? I'm looking for this feature for quite a while and it's kind of disheartening to see this PR and its predecessor be practically dead.

— Reply to this email directly, view it on GitHub https://github.com/yshui/picom/pull/765#issuecomment-1250906749, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJJ4AHNET5XQK3L3UIJ6KYTV7BGMBANCNFSM5MTRBCUA . You are receiving this because you were mentioned.Message ID: @.***>

rajansaini691 avatar Sep 19 '22 21:09 rajansaini691

Hello, thanks for the response! I'm both lacking the time and C skills to implement it sadly, but I use my laptop in public a lot so I hope that someone will integrate them soon.

schrottkatze avatar Sep 21 '22 12:09 schrottkatze

@obsidianical Apologies, things came up after my first rebase in July and I forgot to push. I rebased again yesterday (only one new commit) and pushed just now after making sure it still works.

Most conflicts were from new window-shadow-fg and window-shadow-fg-rule options added in 654772b8cf956b645d3202b3671485714dd18f38. I'm unsure if it adds similar (or underlying) functionality that could replace or support this PR. It could be something else entirely...


I plan to throw a test config together later today after some sleep to try the plain next branch. If the functionality of this PR isn't already added by 654772b8cf956b645d3202b3671485714dd18f38 then I have no problem getting back to work resolving some of the original review issues.

dshoreman avatar Sep 28 '22 03:09 dshoreman

image

Finally(!) found enough time to get back to work on this again :tada:

@yshui I'm pretty sure everything's done now, but would you mind reviewing again in case I've missed anything? Thanks!

dshoreman avatar Apr 18 '23 01:04 dshoreman