Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add foreground blurring #490

Closed
wants to merge 6 commits into from
Closed

Conversation

rajansaini691
Copy link

@rajansaini691 rajansaini691 commented Sep 14, 2020

Discussion started from issue #489.

The end goal is to create a "focus mode" that blurs inactive windows. This is very much still a work in progress.

So far I have given windows a blur_foreground option and have successfully gotten it to work. Still need to:

  • Apply the blur when and only when the window is inactive and focus mode is enabled
  • Get a --focus-mode command line option

I am worried about strong coupling between modes and behaviors, which is preventing me from making progress. Ideally, the logic should be placed at a higher level rather than in paint_all_new. Does anyone more familiar with the codebase have any recommendations?

@codecov
Copy link

codecov bot commented Sep 14, 2020

Codecov Report

Merging #490 into next will decrease coverage by 0.06%.
The diff coverage is 27.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #490      +/-   ##
==========================================
- Coverage   36.86%   36.80%   -0.07%     
==========================================
  Files          45       45              
  Lines        8907     8917      +10     
==========================================
- Hits         3284     3282       -2     
- Misses       5623     5635      +12     
Impacted Files Coverage Δ
src/config.c 41.32% <ø> (ø)
src/config.h 23.52% <ø> (ø)
src/options.c 21.42% <0.00%> (-0.21%) ⬇️
src/win.h 41.66% <ø> (ø)
src/config_libconfig.c 58.13% <33.33%> (-0.23%) ⬇️
src/backend/backend.c 69.27% <40.00%> (-1.10%) ⬇️
src/picom.c 68.66% <0.00%> (-0.29%) ⬇️
src/win.c 64.47% <0.00%> (-0.11%) ⬇️

@tryone144
Copy link
Collaborator

  • Apply the blur when and only when the window is inactive and focus mode is enabled

If I am not mistaken, similar logic to opacity is needed that updates the blur_foreground flag of a window. Code for that should be in win.c.

  • Get a --focus-mode command line option

I was thinking --blur-inactive might be more descriptive as --focus-mode is kind of vague on what it actually does. You can find the config options in config.c with actual parsing in config_libconfig.c. Command line options are declared and parsed in options.c.

I am worried about strong coupling between modes and behaviors, which is preventing me from making progress. Ideally, the logic should be placed at a higher level rather than in paint_all_new. Does anyone more familiar with the codebase have any recommendations?

Yes, paint_all_new() should just be concerned about applying the blur if the window's foreground should be blurred. Updating that flag might be best done in win_on_factor_change() (see above).

Regarding the style "errors": You can either configure your editor to use the provided clang-format style file or run clang-format -style=file on the source file manually.

@yshui
Copy link
Owner

yshui commented Sep 15, 2020

First of all thanks for your contribution!

--blur-inactive

inactive-blur is probably more consistent with the current option names. Also a inactive-blur-exclude would be a good to have.

Ideally, the logic should be placed at a higher level rather than in paint_all_new.

I think it's fine for it to be in paint_all_new. May I ask why you think otherwise?

@rajansaini691
Copy link
Author

rajansaini691 commented Sep 16, 2020

@tryone144 and @yshui thanks for the feedback! That sounds good, I'll add an option called inactive-blur.

The reason I was reluctant to put the logic in paint_all_new is because I thought it might be more maintainable to decouple foreground blurring from a specific option. This way, in the future, others could add other options that blur a window's foreground without touching paint_all_new. However, if you're okay with the strong coupling, that makes my end much easier.

Edit: Also, sorry, what would the behavior of inactive-blur-exclude be?

@rajansaini691
Copy link
Author

Jus added an option and logic for blurring inactive. It seems to work, though it slows down switches between panes and occasionally does not blur my browser (qutebrowser) when it unfocuses.

@yshui
Copy link
Owner

yshui commented Sep 16, 2020

@rajansaini691 Ah, I see what you mean.

Yes, I agree with @tryone144, paint_all_new should just check a flag set on the window to determine if the blur should be applied, instead of checking the option. And that window flag can be set in win_on_factor_change.

@yshui
Copy link
Owner

yshui commented Sep 16, 2020

BTW, @tryone144, do you have access to the CircleCI? e.g. can you restart CI jobs, etc.

@tryone144
Copy link
Collaborator

Edit: Also, sorry, what would the behavior of inactive-blur-exclude be?

Analogous to the other *-exclude options, windows that match the rules in there should not be affected by the foreground blur when inactive.

BTW, @tryone144, do you have access to the CircleCI? e.g. can you restart CI jobs, etc.

Seems so, I just restarted the failed test job.

@rajansaini691
Copy link
Author

rajansaini691 commented Jan 18, 2022

I stopped work on this feature, but the majority of the work has already been done :)

@yshui
Copy link
Owner

yshui commented Oct 29, 2022

Closed due to inactivity and the PR can't be merged in its current form.

@yshui yshui closed this Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants