Tomas-M / xlunch

Graphical app launcher for X with minimal dependencies
http://xlunch.org
GNU General Public License v3.0
219 stars 37 forks source link

Are you sure you can't add a blurred background setting? #128

Closed Botspot closed 3 years ago

Botspot commented 3 years ago

I did it and it looks amazing!
2020-11-27-112336_1920x1080_scrot
Are you sure this is out of the scope of xlunch? (I think many people would find it useful)

Botspot commented 3 years ago

I did it like this:

screen_width="$(xdpyinfo | grep 'dimensions:' | tr 'x' '\n' | tr ' ' '\n' | sed -n 7p)"
screen_height="$(xdpyinfo | grep 'dimensions:' | tr 'x' '\n' | tr ' ' '\n' | sed -n 8p)"
height=700
width=800
xposition=$(((screen_width/2)-(width/2)))
yposition=$(((screen_height/2)-(height/2)))
scrot -a "$((xposition+1)),$((yposition+33)),${width},${height}" blur.png
convert -blur 10x5 ~/blur.png ~/blur.png
xlunch -g ~/blur.png --width $width --height $height --xposition $xposition --yposition $yposition

Notice I had to account for the window border when I did $((xposition+1)),$((yposition+33)). I think if xlunch had an option for this, it would be a cleaner way to do it, and the blur would not be offset on other installs with differently-sized window borders.

PMunch commented 3 years ago

The problem is that there isn't really a clean solution for this on all systems, and it would potentially add a dependency to xlunch which we try to avoid to keep it light. Since windows in X can be moved and resized multiple times before the user even sees them it's not as simple as grabbing it once on startup from within the program. And calling another program to deal with this from inside xlunch in quite hacky. The truth is that this can already be achieved much better than any hack we can implement by adjusting a couple settings in most compositors. So a hack in xlunch to do something a script could do and a compositor could do better simply isn't a good value.

Botspot commented 3 years ago

Hmm, I see your point.

PMunch commented 3 years ago

Yeah it's a bit unfortunate, but this inter-window relationship is really the domain of the compositor.

Botspot commented 3 years ago

I wonder how conky does it. Conky uses a pseudo-transparent background, ie, it captures what's behind it and uses that as its own background. It does not require a compositor to work.
Conky could probably blur it's background quite easily.

Perhaps we could do something like this? (a pseudo-transparent background at least)

PMunch commented 3 years ago

Yeah it's not impossible, but it requires us to add a blur algorithm to xlunch and a bunch of logic for capturing what is behind it. All the while compositors are available and ready to use this effect.