tryone144 / compton

A compositor for X11.
Other
617 stars 235 forks source link

exclude screenshot tool from blur #44

Closed julian-g99 closed 4 years ago

julian-g99 commented 4 years ago

I really like this compositor so far, as it finally allows me to achieve kawase blur, but I'm having a small issue where the screenshot tool also gets blurred when I launch it. I am aware of the blur_background_exclude option, but I'm not quite sure what attributes to pass it since I don't know what the WM_class of maim is, or if it even has one. I've tried both maim and Maim. I've also tried all the possible values for window_type.

Problem Description

Platform: Arch Linux with i3-gaps

GPU, drivers, and screen setup: Nvidia 1070Ti, dual monitor

Compton version: beta2-95-g241bbc5-2018-02-22

Compton configuration: see bottom of post

Steps of reproduction

Start the screenshot tool (in my case maim) with compton running.

Expected behavior

The screenshot selection does not get all blurred

Current Behavior & Other details

The entire screen is blurred when selecting region for screenshot. The screenshotted image still looks fine, however.

config:

blur-background=true;

backend = "glx";

blur-method = "kawase";

blur-strength = 10;

opacity-rule = [
    "85: class_g = 'Termite'",
    "85: class_g = 'discord'"
];

Update

I was able to get the effect I want by doing blur_background_exclude = "!(class_g = 'Termite' || <other things I want blurred>)", but would still like know if there's a way to specifically target maim.

tryone144 commented 4 years ago

Not a problem with picom per-se, but here is how I would tackle such an issue:

1. Google:

First result for "maim selection window class": https://github.com/naelstrof/maim/issues/40 :wink:

2. Brute-force method:

Since screenshot-tools usually grab your mouse you can't do the simple sleep 5 && xprop trick before launching the app. Therefore you can query all windows with sleep 5 && xwininfo -root -tree | less to get a list of all open windows. Somewhere in this list you will find the window you are looking for in the format win_id "name" ("instance", "class").

3. Inspect the source:

Maim seem to be using slop for its window/rectangle selection: source Slop in turn, creates its window with the class and instance slop: source

TL;DR

Use blur-background-exclude = ["class_g = 'slop'"]; since maim uses slop to render its selection window.

cybardev commented 4 years ago

@tryone144 Sorry for bothering, but I'm not too techy so I can't figure stuff out. I'm on XFCE and I use the default screenshot tool (xfce4-screenshooter) and it's having the same problem. Any suggestion on how to fix it (what class should I exclude, or such) ?

tryone144 commented 4 years ago

See https://github.com/tryone144/dotfiles/blob/0df607d789a0c891bf829bf1c4f804923af2944c/compton/.config/compton.conf#L65

blur-background-exclude = ["class_g = 'Xfce4-screenshooter'"];

cybardev commented 4 years ago

@tryone144 Oops, sorry, I must've missed it... Thanks a lot. :smiley:

cybardev commented 4 years ago

@tryone144 Ok, sorry, that didn't work. Also, forgot to mention, I'm actually using picom and invoking it with the --experimental-backends flag.

My config file : picom.conf.txt

tryone144 commented 4 years ago

@tryone144 Ok, sorry, that didn't work. Also, forgot to mention, I'm actually using picom and invoking it with the --experimental-backends flag.

Well, it works for me with the latest picom and xfce4-screenshooter 1.9.7... :thinking:

You can try running sleep 5 && xwininfo -root -tree | less and then immediately open the screenshot overlay. The correct names should appear somewhere in the list.

cybardev commented 4 years ago

@tryone144 This error pops up if I execute picom from the terminal and screenshot (background gets blurred). image

Here's the output of your command : picom-info.txt

Is it the wrapper-2.0 ?

cybardev commented 4 years ago

@tryone144 Further info : I'm on Manjaro XFCE, xfce-screenshooter 1.9.7-1, and I'm launching it from the panel applet. I have blur enabled for the panel. Could that be the reason ?

tryone144 commented 4 years ago

@tryone144 This error pops up if I execute picom from the terminal and screenshot (background gets blurred). image

The reported error should not be related to the problem at hand.

Here's the output of your command : picom-info.txt

Is it the wrapper-2.0 ?

Could be. It certainly is large enough. Are these windows still present, when you are not taking a screenshot?

[snip] I'm launching it from the panel applet. [snip]

This can be a problem. I'm not certain how this would be handled by xfce. Try running xfce4-screenshooter manually and see if this produced a different output.

cybardev commented 4 years ago

[snip] I'm launching it from the panel applet. [snip]

This can be a problem. I'm not certain how this would be handled by xfce. Try running xfce4-screenshooter manually and see if this produced a different output.

@tryone144 This is it. Manually running screenshooter from Whisker Menu > Accessories works fine. Background not blurred. I guess I'll add a launcher to the panel for screenshooter instead of using the panel plugin.

cybardev commented 4 years ago

@tryone144 To be honest, this is more convenient for me. I don't know why I didn't do this before. I actually want the screenshot selection dialogue to pop up before I take shots (so I can choose whether to capture full screen or just a part).

Thank you for your time and effort with this amazing fork, as well as helping people relentlessly in the issues. :smile: