Add Firefox Blur Region Fix effect

This commit is contained in:
wackyideas 2024-02-01 01:16:09 +01:00
parent 51aaad1212
commit 4457db451a
26 changed files with 3082 additions and 9 deletions

View file

@ -82,15 +82,10 @@ This is a list of components that are included in this project, as well as their
|-----------------|------------------------------------------------------------------------------------------------------------------------------|--------|----| |-----------------|------------------------------------------------------------------------------------------------------------------------------|--------|----|
|Aero Emerald |Custom, non-standard Emerald theme made to work with Smaragd Seven. Features caption buttons that match the default sizes for both 7 and Vista. |Y |[nicu96](https://store.kde.org/p/1003826/), [Souris-2d07](https://gitgud.io/souris)| |Aero Emerald |Custom, non-standard Emerald theme made to work with Smaragd Seven. Features caption buttons that match the default sizes for both 7 and Vista. |Y |[nicu96](https://store.kde.org/p/1003826/), [Souris-2d07](https://gitgud.io/souris)|
|Reflection Effect|Effect that renders a glassy texture under windows. |N |[KDE](https://invent.kde.org/plasma/kwin/-/tree/master/src/plugins/blur)| |Reflection Effect|Effect that renders a glassy texture under windows. |N |[KDE](https://invent.kde.org/plasma/kwin/-/tree/master/src/plugins/blur)|
|Firefox Blur Region Fix|Effect that fixes Firefox's transparency and allows it to have proper blur and reflections. |N |N/A|
|Smaragd Seven |KWin decoration theme which uses Emerald themes as a basis, with some Aero specific changes and bugfixes. Lacks HiDPI support.|N |[KDE](https://invent.kde.org/plasma/smaragd)| |Smaragd Seven |KWin decoration theme which uses Emerald themes as a basis, with some Aero specific changes and bugfixes. Lacks HiDPI support.|N |[KDE](https://invent.kde.org/plasma/smaragd)|
|Thumbnail Seven |KWin task switcher that mostly replicates the look and behavior of Windows 7's task switcher|N|[KDE](https://invent.kde.org/plasma/kwin/-/tree/master/src/tabbox/switchers/thumbnail_grid)| |Thumbnail Seven |KWin task switcher that mostly replicates the look and behavior of Windows 7's task switcher|N|[KDE](https://invent.kde.org/plasma/kwin/-/tree/master/src/tabbox/switchers/thumbnail_grid)|
### Applications
|Name |Description |Finished|Fork|
|--------------|-----------------------------------------------------------------------|--------|----|
|AeroColorMixer|Program designed for changing the accent color across the entire theme. **(NOTE: This program is now deprecated and has been moved into the reflection effect.)**|Y |N/A |
### Miscellaneous ### Miscellaneous
|Name |Description |Finished|Fork| |Name |Description |Finished|Fork|
@ -99,8 +94,6 @@ This is a list of components that are included in this project, as well as their
|Install script |Installation script for AeroThemePlasma.|N |N/A| |Install script |Installation script for AeroThemePlasma.|N |N/A|
## Components to be implemented <a name="todo"></a> ## Components to be implemented <a name="todo"></a>
These components are listed from highest priority to lowest priority. These components are listed from highest priority to lowest priority.

View file

@ -294,7 +294,7 @@ cd ./KWin/kwin_reflect/
sh install.sh sh install.sh
``` ```
After it has been compiled, you can log out or restart plasma and kwin, then go to ```System settings -> Workspace Behavior -> Desktop Effects``` and enable the effect. After it has been compiled, you can log out or restart Plasma and KWin, then go to ```System settings -> Workspace Behavior -> Desktop Effects``` and enable the effect.
### Plasma Widgets <a name="widgets"></a> ### Plasma Widgets <a name="widgets"></a>
@ -520,3 +520,31 @@ The last part will print the provided string every time a new bash session is st
The project [Aero UserChrome](https://gitgud.io/souris/aero-userchrome) by [Souris-2d07](https://gitgud.io/souris) is recommended for use with AeroThemePlasma. The project [Aero UserChrome](https://gitgud.io/souris/aero-userchrome) by [Souris-2d07](https://gitgud.io/souris) is recommended for use with AeroThemePlasma.
In order to correctly apply blur and reflections onto Firefox, it's required to install the Firefox Blur Region Fix KWin effect.
To install the effect, it's recommended to build it from source, as dumping the precompiled files doesn't seem to work on its own.
Go to the folder:
```
cd ./KWin/kwin_fixblur/
sh install.sh
```
After it has been compiled, you can log out or restart Plasma and KWin, then go to ```System settings -> Workspace Behavior -> Desktop Effects``` and enable the effect.
By default, this effect is enabled for Firefox. If you're using a different Firefox-based browser (Firefox ESR, Nightly, Floorp, Librewolf, etc.), then they need to be included in the config menu by adding their secondary window class name to the list.
For example, to apply the effect to both Firefox and Librewolf, the config's text box should contain the text:
```
firefox;librewolf
```
Additionally, this effect loads in an SVG file from the following directory:
```
$ ~/.emerald/ffBlurRegion.svg
```
which should be there assuming the rest of the installation has been done.

1350
KWin/.emerald/ffBlurRegion.svg Executable file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 50 KiB

View file

@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.0)
project(kwin4_effect_customblur)
set(KF_MIN_VERSION "5.78")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${ECM_MODULE_PATH}
${ECM_KDE_MODULE_DIR}
#${ECM_KDE_MODULE_DIR}/kwin
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_SOURCE_DIR}/cmake/Modules
)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
find_package(Qt5 REQUIRED COMPONENTS
Core
DBus
Gui
)
find_package(KDecoration2 REQUIRED)
find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS
Config
ConfigWidgets
CoreAddons
WindowSystem
Wayland
)
find_package(KF5Plasma)
#find_package(kwin REQUIRED)
find_package(kwineffects REQUIRED COMPONENTS
kwineffects
kwinglutils
)
find_package(KWinDBusInterface CONFIG REQUIRED)
find_package(epoxy REQUIRED)
add_subdirectory(src)
feature_summary(WHAT ALL)

339
KWin/kwin_fixblur/LICENSE Executable file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

113
KWin/kwin_fixblur/README.md Executable file
View file

@ -0,0 +1,113 @@
# Kwin blur effect - Respect rounded corners
This kwin effect is a fork of the default kwin blur effect, with minimal changes
to solve the ["plasma kornerbug"](https://bugs.kde.org/show_bug.cgi?id=395725).
It works with all decorations, including aurorae one's, and take care of maximized windows, that are assumed to not have rounded corners.
![Screenshot](doc/demo.png)
*Above left : Korner bug with the default blur effect*
*Above right : with the present blur effect*
*(Window decorations : [classikstyles](https://github.com/paulmcauley/classikstyles) by paulmcauly)*
## Usage
After installing the effect, go to Settings --> Workspace behavior --> Desktop Effects.
- Disable the default blur effect ("Blur")
- Enable "Blur - Respect rounded corners"
- Tweak the settings of the effect to match your window decorations.
![Settings](doc/settings.png)
## Limitations
The effect only acts for window decorations. If the window has a decoration that have to be blurred and is not maximized, the rounded corners area are removed from the region "to be blurred". (before the blur occurs)
It seems to be not compatible with [ligthlyShaders](https://github.com/a-parhom/LightlyShaders) or [shapecorners](https://sourceforge.net/projects/shapecorners/).
## Plasma version
I only tested the effect on plasma 5.23.3, I don't know if it work with older versions (But it should, the changes from the default blur effect are very minimal)
## Installation
### Binary package
If you build a binary package, or make the effect available from the "kde get new stuff" service, let me know !
### Build from source
*Section copied from* [Yet another magic lamp](https://github.com/zzag/kwin-effects-yet-another-magic-lamp) from zzag.
You will need the following dependencies to build this effect:
* CMake
* any C++14 enabled compiler
* Qt
* libkwineffects
* KDE Frameworks 5:
- Config
- CoreAddons
- Extra CMake Modules
- WindowSystem
On Arch Linux
```sh
sudo pacman -S cmake extra-cmake-modules kwin
```
On Fedora
```sh
sudo dnf install cmake extra-cmake-modules kf5-kconfig-devel \
kf5-kcoreaddons-devel kf5-kwindowsystem-devel kwin-devel \
qt5-qtbase-devel libepoxy-devel kf5-kconfigwidgets-devel
```
On fedora 35, it seems you need the following dep too :
```
kwayland-server-devel
kf5-kwayland-devel
wayland-devel
```
On OpenSUSE
```sh
sudo zypper install cmake extra-cmake-modules kconfig-devel \
kcoreaddons-devel kwindowsystem-devel kwin5-devel \
libqt5-qtbase-devel libepoxy-devel kconfigwidgets-devel \
kwayland-server-devel
```
On Ubuntu
```sh
sudo apt install cmake extra-cmake-modules kwin-dev \
libkf5config-dev libkf5configwidgets-dev libkf5coreaddons-dev \
libkf5windowsystem-dev qtbase5-dev libkwaylandserver-dev libwayland-dev
```
### After you installed all the required dependencies, clone the repo and use the provided scripts :
Build and install:
```sh
chmod +x install.sh
./install.sh
```
Uninstall build script:
```sh
chmod +x uninstall.sh
./uninstall.sh
```
## Contributing
Any help is welcome. Feel free to fill an issue if you have one.

View file

@ -0,0 +1,101 @@
#.rst:
# Findkwineffects
# ---------------
#
# Try to find libkwineffects.
#
# This is a component-based find module, which makes use of the COMPONENTS
# argument to find_modules. The following components are
# available::
#
# kwineffects
# kwinglutils
# kwinxrenderutils
#
# If no components are specified, this module will act as though all components
# were passed to OPTIONAL_COMPONENTS.
#
# This module will define the following variables, independently of the
# components searched for or found:
#
# ``kwineffects_FOUND``
# True if (the requestion version of) libkwineffects is available
# ``kwineffects_TARGETS``
# A list of all targets imported by this module (note that there may be more
# than the components that were requested)
# ``kwineffects_LIBRARIES``
# This can be passed to target_link_libraries() instead of the imported
# targets
# ``kwineffects_INCLUDE_DIRS``
# This should be passed to target_include_directories() if the targets are
# not used for linking
# ``kwineffects_DEFINITIONS``
# This should be passed to target_compile_options() if the targets are not
# used for linking
#
# For each searched-for components, ``kwineffects_<component>_FOUND`` will be
# set to true if the corresponding libkwineffects library was found, and false
# otherwise. If ``kwineffects_<component>_FOUND`` is true, the imported target
# ``kwineffects::<component>`` will be defined.
#=============================================================================
# Copyright 2019 Vlad Zagorodniy <vladzzag@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
include(ECMFindModuleHelpers)
ecm_find_package_version_check(kwineffects)
set(kwineffects_known_components
kwineffects
kwinglutils
kwinxrenderutils
)
set(kwineffects_default_components ${kwineffects_known_components})
set(kwineffects_kwineffects_header "kwineffects.h")
set(kwineffects_kwineffects_lib "kwineffects")
set(kwineffects_kwinglutils_header "kwinglutils.h")
set(kwineffects_kwinglutils_lib "kwinglutils")
set(kwineffects_kwinxrenderutils_header "kwinxrenderutils.h")
set(kwineffects_kwinxrenderutils_lib "kwinxrenderutils")
ecm_find_package_parse_components(kwineffects
RESULT_VAR kwineffects_components
KNOWN_COMPONENTS ${kwineffects_known_components}
DEFAULT_COMPONENTS ${kwineffects_default_components}
)
ecm_find_package_handle_library_components(kwineffects
COMPONENTS ${kwineffects_components}
)
find_package_handle_standard_args(kwineffects
FOUND_VAR
kwineffects_FOUND
REQUIRED_VARS
kwineffects_LIBRARIES
HANDLE_COMPONENTS
)

View file

@ -0,0 +1,20 @@
include (UsePkgConfig)
macro (pkgconfig_getvar _package _var _output_variable)
SET (${_output_variable})
if (PKGCONFIG_EXECUTABLE)
exec_program (${PKGCONFIG_EXECUTABLE}
ARGS ${_package} --exists
RETURN_VALUE _return_VALUE
OUTPUT_VARIABLE _pkgconfigDevNull
)
if (NOT _return_VALUE)
exec_program (${PKGCONFIG_EXECUTABLE}
ARGS ${_package} --variable ${_var}
OUTPUT_VARIABLE ${_output_variable}
)
endif ()
endif ()
endmacro ()

12
KWin/kwin_fixblur/install Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
ORIGINAL_DIR=$(pwd)
rm -rf build
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
make
#sudo make install
cd $ORIGINAL_DIR

12
KWin/kwin_fixblur/install.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
ORIGINAL_DIR=$(pwd)
rm -rf build
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
make
sudo make install
cd $ORIGINAL_DIR

View file

@ -0,0 +1,35 @@
add_subdirectory(kcm)
set(effect_SRCS
blur.cpp
main.cpp
)
kconfig_add_kcfg_files(effect_SRCS
blurconfig.kcfgc
)
add_library(kwin4_effect_customblur SHARED ${effect_SRCS})
target_link_libraries(kwin4_effect_customblur
KDecoration2::KDecoration
Qt5::Core
Qt5::Gui
KF5::ConfigCore
KF5::ConfigGui
KF5::CoreAddons
KF5::WindowSystem
kwineffects::kwineffects
kwineffects::kwinglutils
epoxy::epoxy
KF5::Plasma
)
install(
TARGETS
kwin4_effect_customblur
DESTINATION
${PLUGIN_INSTALL_DIR}/kwin/effects/plugins/
)

View file

@ -0,0 +1,211 @@
/*
SPDX-FileCopyrightText: 2010 Fredrik Höglund <fredrik@kde.org>
SPDX-FileCopyrightText: 2011 Philipp Knechtges <philipp-dev@knechtges.com>
SPDX-FileCopyrightText: 2018 Alex Nemeth <alex.nemeth329@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "blur.h"
// KConfigSkeleton
#include "blurconfig.h"
#include <QGuiApplication>
#include <QMatrix4x4>
#include <QScreen>
#include <QTime>
#include <QTimer>
#include <QWindow>
#include <cmath> // for ceil()
#include <cstdlib>
#include <QFile>
#include <QBuffer>
#include <QDataStream>
#include <QColor>
#include <QPair>
#include <QPainterPath>
#include <QStringLiteral>
#include <QBitmap>
#include <KConfigGroup>
#include <KSharedConfig>
#include <KWindowEffects>
#include <KDecoration2/Decoration>
namespace KWin
{
BlurEffect::BlurEffect()
{
defaultSvg.setImagePath(svgPath);
defaultSvg.setUsingRenderingCache(false);
initConfig<BlurConfig>();
reconfigure(ReconfigureAll);
connect(effects, &EffectsHandler::windowAdded, this, &BlurEffect::slotWindowAdded);
connect(effects, &EffectsHandler::propertyNotify, this, &BlurEffect::slotPropertyNotify);
connect(effects, &EffectsHandler::windowFrameGeometryChanged, this, &BlurEffect::slotWindowFrameGeometryChanged);
updateAllWindows();
}
void BlurEffect::updateAllWindows()
{
const auto stackingOrder = effects->stackingOrder();
for (EffectWindow *w: stackingOrder) {
if(isWindowValid(w)) {
applyBlurRegion(w);
}
}
}
bool BlurEffect::isWindowValid(KWin::EffectWindow *w)
{
QStringList classes = w->windowClass().split(' ');
bool valid = classes[0] == "navigator";
if(classes.size() > 1)
{
valid = valid && m_includedWindows.contains(classes[1]);
}
return valid;
}
BlurEffect::~BlurEffect()
{
}
void BlurEffect::updateTexture()
{
if(m_texturePath == "" || !QFile::exists(m_texturePath))
{
m_texturePath = svgPath;
}
defaultSvg.setImagePath(m_texturePath);
}
void BlurEffect::reconfigure(ReconfigureFlags flags)
{
BlurConfig::self()->read();
m_includedWindows = BlurConfig::includedWindows().split(';');
m_texturePath = BlurConfig::textureLocation();
updateTexture();
updateAllWindows();
effects->addRepaintFull();
}
QRegion BlurEffect::getForcedNewRegion()
{
defaultSvg.clearCache();
QPixmap alphaMask = defaultSvg.alphaMask();
const qreal dpr = alphaMask.devicePixelRatio();
// region should always be in logical pixels, resize pixmap to be in the logical sizes
if (alphaMask.devicePixelRatio() != 1.0) {
alphaMask = alphaMask.scaled(alphaMask.width() / dpr, alphaMask.height() / dpr);
}
return QRegion(QBitmap(alphaMask.mask()));
}
void BlurEffect::applyBlurRegion(KWin::EffectWindow *w)
{
QWindow* win = w->isWaylandClient() ? w->internalWindow() : QWindow::fromWinId(w->windowId());
defaultSvg.resizeFrame(w->size());
QRegion mask = defaultSvg.mask();
if(mask.boundingRect().size() != w->size().toSize())
{
mask = getForcedNewRegion();
}
//win->setMask(mask);
KWindowEffects::enableBlurBehind(win, true, mask);//QRegion(0, 0, w->size().width(), w->size().height()));
}
void BlurEffect::slotWindowAdded(EffectWindow *w)
{
if(isWindowValid(w)) {
applyBlurRegion(w);
}
}
void BlurEffect::slotWindowFinishUserMovedResized(KWin::EffectWindow *w)
{
}
void BlurEffect::slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRectF &oldGeometry)
{
if(isWindowValid(w)) {
if(oldGeometry.size() != w->size())
{
applyBlurRegion(w);
}
}
}
void BlurEffect::slotWindowDeleted(EffectWindow *w)
{
}
void BlurEffect::slotPropertyNotify(EffectWindow *w, long atom)
{
if(w) {
if(w->decoration() && isWindowValid(w)) {
applyBlurRegion(w);
}
}
}
bool BlurEffect::enabledByDefault()
{
GLPlatform *gl = GLPlatform::instance();
if (gl->isIntel() && gl->chipClass() < SandyBridge) {
return false;
}
if (gl->isPanfrost() && gl->chipClass() <= MaliT8XX) {
return false;
}
// The blur effect works, but is painfully slow (FPS < 5) on Mali and VideoCore
if (gl->isLima() || gl->isVideoCore4() || gl->isVideoCore3D()) {
return false;
}
if (gl->isSoftwareEmulation()) {
return false;
}
return true;
}
bool BlurEffect::supported()
{
bool supported = effects->isOpenGLCompositing() && GLFramebuffer::supported() && GLFramebuffer::blitSupported();
if (supported) {
int maxTexSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
const QSize screenSize = effects->virtualScreenSize();
if (screenSize.width() > maxTexSize || screenSize.height() > maxTexSize) {
supported = false;
}
}
return supported;
}
void BlurEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime)
{
// We perform a bit of tomfoolery :)
// massive if factual
if(isWindowValid(w))
{
data.setTranslucent();
}
effects->prePaintWindow(w, data, presentTime);
}
bool BlurEffect::isActive() const
{
return !effects->isScreenLocked();
}
bool BlurEffect::blocksDirectScanout() const
{
return false;
}
} // namespace KWin

View file

@ -0,0 +1,84 @@
/*
SPDX-FileCopyrightText: 2010 Fredrik Höglund <fredrik@kde.org>
SPDX-FileCopyrightText: 2018 Alex Nemeth <alex.nemeth329@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <kwineffects.h>
#include <kwinglplatform.h>
#include <kwinglutils.h>
#include <KF5/KWayland/Server/blur_interface.h>
#include <KF5/KWayland/Server/display.h>
#include <KF5/KWayland/Server/surface_interface.h>
#include <QStack>
#include <QVector2D>
#include <QVector>
#include <QDir>
#include <QSharedMemory>
#include <Plasma/FrameSvg>
namespace KWin
{
static const int borderSize = 5;
class BlurShader;
class BlurEffect : public KWin::Effect
{
Q_OBJECT
public:
BlurEffect();
~BlurEffect() override;
static bool supported();
static bool enabledByDefault();
void reconfigure(ReconfigureFlags flags) override;
//void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime) override;
//void drawWindow(EffectWindow *w, int mask, const QRegion &region, WindowPaintData &data) override;
bool provides(Feature feature) override;
bool isActive() const override;
int requestedEffectChainPosition() const override
{
return 19;
}
bool blocksDirectScanout() const override;
bool isWindowValid(KWin::EffectWindow *w);
void applyBlurRegion(KWin::EffectWindow *w);
void updateTexture();
QRegion getForcedNewRegion();
void updateAllWindows();
public Q_SLOTS:
void slotWindowAdded(KWin::EffectWindow *w);
void slotWindowDeleted(KWin::EffectWindow *w);
void slotPropertyNotify(KWin::EffectWindow *w, long atom);
void slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRectF &oldGeometry);
void slotWindowFinishUserMovedResized(KWin::EffectWindow *w);
//void slotScreenGeometryChanged();
private:
QString svgPath = QDir::homePath() + "/.emerald/ffBlurRegion.svg";
Plasma::FrameSvg defaultSvg;
QStringList m_includedWindows;
QString m_texturePath;
};
inline bool BlurEffect::provides(Effect::Feature feature)
{
if (feature == Blur) {
return true;
}
return KWin::Effect::provides(feature);
}
} // namespace KWin

17
KWin/kwin_fixblur/src/blur.kcfg Executable file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile arg="true"/>
<group name="Effect-Reflection">
<entry name="TextureLocation" type="String">
<default></default>
</entry>
<entry name="IncludedWindows" type="String">
<default>firefox</default>
</entry>
</group>
</kcfg>

View file

@ -0,0 +1,5 @@
File=blur.kcfg
ClassName=BlurConfig
NameSpace=KWin
Singleton=true
Mutators=true

View file

@ -0,0 +1,167 @@
/*
SPDX-FileCopyrightText: 2010 Fredrik Höglund <fredrik@kde.org>
SPDX-FileCopyrightText: 2018 Alex Nemeth <alex.nemeth329@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "blurshader.h"
#include <kwineffects.h>
static void ensureResources()
{
Q_INIT_RESOURCE(blur);
}
namespace KWin
{
BlurShader::BlurShader(QObject *parent)
: QObject(parent)
{
ensureResources();
m_shaderReflectsample = ShaderManager::instance()->generateShaderFromFile(
ShaderTrait::MapTexture,
QStringLiteral(":/effects/blur/shaders/vertex.vert"),
QStringLiteral(":/effects/blur/shaders/reflect.frag"));
m_shaderColorsample = ShaderManager::instance()->generateShaderFromFile(
ShaderTrait::MapTexture,
QStringLiteral(":/effects/blur/shaders/vertex.vert"),
QStringLiteral(":/effects/blur/shaders/color.frag"));
m_valid = m_shaderReflectsample->isValid() && m_shaderColorsample->isValid();
if (m_valid) {
m_mvpMatrixLocationReflectsample = m_shaderReflectsample->uniformLocation("modelViewProjectionMatrix");
m_opacityLocationReflectsample = m_shaderReflectsample->uniformLocation("opacity");
m_screenResolutionLocationReflectsample = m_shaderReflectsample->uniformLocation("screenResolution");
m_windowPosLocationReflectsample = m_shaderReflectsample->uniformLocation("windowPos");
m_windowSizeLocationReflectsample = m_shaderReflectsample->uniformLocation("windowSize");
m_translateTextureLocationReflectsample = m_shaderReflectsample->uniformLocation("translate");
m_colorLocationColorsample = m_shaderColorsample->uniformLocation("color");
m_mvpMatrixLocationColorsample = m_shaderColorsample->uniformLocation("modelViewProjectionMatrix");
m_opacityLocationColorsample = m_shaderColorsample->uniformLocation("opacity");
QMatrix4x4 modelViewProjection;
const QSize screenSize = effects->virtualScreenSize();
modelViewProjection.ortho(0, screenSize.width(), screenSize.height(), 0, 0, 65535);
// Add default values to the uniforms of the shaders
ShaderManager::instance()->pushShader(m_shaderReflectsample.get());
m_shaderReflectsample->setUniform(m_mvpMatrixLocationReflectsample, modelViewProjection);
m_shaderReflectsample->setUniform(m_opacityLocationReflectsample, float(1.0));
m_shaderReflectsample->setUniform(m_screenResolutionLocationReflectsample, QVector2D(1.0, 1.0));
m_shaderReflectsample->setUniform(m_windowPosLocationReflectsample, QVector2D(1.0, 1.0));
m_shaderReflectsample->setUniform(m_windowSizeLocationReflectsample, QVector2D(1.0, 1.0));
m_shaderReflectsample->setUniform(m_translateTextureLocationReflectsample, float(1.0));
ShaderManager::instance()->popShader();
ShaderManager::instance()->pushShader(m_shaderColorsample.get());
m_shaderColorsample->setUniform(m_mvpMatrixLocationColorsample, modelViewProjection);
m_shaderColorsample->setUniform(m_colorLocationColorsample, QVector4D(0,0,0,1));
m_shaderColorsample->setUniform(m_opacityLocationColorsample, float(1.0));
ShaderManager::instance()->popShader();
}
}
BlurShader::~BlurShader()
{
}
void BlurShader::setColor(QColor col)
{
if(!isValid()) return;
QVector4D vec(col.redF(), col.greenF(), col.blueF(), col.alphaF());
m_colorColorsample = vec;
m_shaderColorsample->setUniform(m_colorLocationColorsample, m_colorColorsample);
return;
if(vec == m_colorColorsample) {
return;
}
}
void BlurShader::setTranslateTexture(bool translate)
{
if(!isValid()) return;
m_shaderReflectsample->setUniform(m_translateTextureLocationReflectsample, translate ? float(1.0) : float(0.0));
}
void BlurShader::setModelViewProjectionMatrix(const QMatrix4x4 &matrix, bool color)
{
if (!isValid()) {
return;
}
if(color)
{
if(matrix == m_matrixColorsample)
{
return;
}
m_matrixColorsample = matrix;
m_shaderColorsample->setUniform(m_mvpMatrixLocationColorsample, matrix);
return;
}
if (matrix == m_matrixReflectsample) {
return;
}
m_matrixReflectsample = matrix;
m_shaderReflectsample->setUniform(m_mvpMatrixLocationReflectsample, matrix);
}
void BlurShader::setOpacity(float opacity, bool color)
{
if (!isValid()) {
return;
}
if(color) m_shaderColorsample->setUniform(m_opacityLocationColorsample, opacity);
else m_shaderReflectsample->setUniform(m_opacityLocationReflectsample, opacity);
}
void BlurShader::setScreenResolution(const QSize &screenResolution)
{
if (!isValid()) {
return;
}
const QVector2D screenSize(screenResolution.width(), screenResolution.height());
m_shaderReflectsample->setUniform(m_screenResolutionLocationReflectsample, screenSize);
}
void BlurShader::setWindowSize(const QSize &windowSize)
{
const QVector2D wSize(windowSize.width(), windowSize.height());
m_shaderReflectsample->setUniform(m_windowSizeLocationReflectsample, wSize);
}
void BlurShader::setWindowPosition(const QPoint &pos)
{
m_shaderReflectsample->setUniform(m_windowPosLocationReflectsample, QVector2D(pos.x(), pos.y()));
}
void BlurShader::bind(bool color)
{
if (!isValid()) {
return;
}
if(color)
{
ShaderManager::instance()->pushShader(m_shaderColorsample.get());
}
else
ShaderManager::instance()->pushShader(m_shaderReflectsample.get());
}
void BlurShader::unbind()
{
ShaderManager::instance()->popShader();
}
} // namespace KWin

View file

@ -0,0 +1,68 @@
/*
SPDX-FileCopyrightText: 2010 Fredrik Höglund <fredrik@kde.org>
SPDX-FileCopyrightText: 2018 Alex Nemeth <alex.nemeth329@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <kwinglutils.h>
#include <QMatrix4x4>
#include <QObject>
#include <QVector2D>
#include <QVector4D>
namespace KWin
{
class BlurShader : public QObject
{
Q_OBJECT
public:
BlurShader(QObject *parent = nullptr);
~BlurShader() override;
bool isValid() const;
void bind(bool color = false);
void unbind();
void setModelViewProjectionMatrix(const QMatrix4x4 &matrix, bool color = false);
void setOpacity(float opacity, bool color = false);
void setScreenResolution(const QSize &screenResolution);
void setWindowSize(const QSize &windowSize);
void setWindowPosition(const QPoint &pos);
void setTranslateTexture(bool translate);
void setColor(QColor color);
private:
std::unique_ptr<GLShader> m_shaderReflectsample;
std::unique_ptr<GLShader> m_shaderColorsample;
int m_screenResolutionLocationReflectsample;
int m_windowPosLocationReflectsample;
int m_opacityLocationReflectsample;
int m_mvpMatrixLocationReflectsample;
int m_windowSizeLocationReflectsample;
int m_translateTextureLocationReflectsample;
int m_colorLocationColorsample;
int m_mvpMatrixLocationColorsample;
int m_opacityLocationColorsample;
QMatrix4x4 m_matrixReflectsample;
QMatrix4x4 m_matrixColorsample;
QVector4D m_colorColorsample;
bool m_valid = false;
Q_DISABLE_COPY(BlurShader);
};
inline bool BlurShader::isValid() const
{
return m_valid;
}
} // namespace KWin

View file

@ -0,0 +1,41 @@
set(kcm_SRCS
blur_config.cpp
)
kconfig_add_kcfg_files(kcm_SRCS
../blurconfig.kcfgc
)
qt5_wrap_ui(kcm_SRCS blur_config.ui mainwindow.ui)
qt5_add_dbus_interface(kcm_SRCS ${KWIN_EFFECTS_INTERFACE} kwineffects_interface)
add_library(kwin4_effect_customblur_config MODULE ${kcm_SRCS})
target_link_libraries(kwin4_effect_customblur_config
Qt5::Core
Qt5::DBus
Qt5::Gui
KF5::ConfigCore
KF5::ConfigGui
KF5::ConfigWidgets
KF5::CoreAddons
KF5::WindowSystem
KF5::WaylandClient
KF5::WaylandServer
kwineffects::kwineffects
kwineffects::kwinglutils
epoxy::epoxy
KDecoration2::KDecoration
)
kcoreaddons_desktop_to_json(kwin4_effect_customblur_config blur_config.desktop SERVICE_TYPES kcmodule.desktop)
install(
TARGETS
kwin4_effect_customblur_config
DESTINATION
${PLUGIN_INSTALL_DIR}/kwin/effects/configs
)

View file

@ -0,0 +1,77 @@
/*
SPDX-FileCopyrightText: 2010 Fredrik Höglund <fredrik@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "blur_config.h"
// KConfigSkeleton
#include "blurconfig.h"
//#include <config-kwin.h>
#include <kwineffects_interface.h>
#include <KAboutData>
#include <KPluginFactory>
#include <QDir>
K_PLUGIN_FACTORY_WITH_JSON(BlurEffectConfigFactory,
"blur_config.json",
registerPlugin<KWin::BlurEffectConfig>();)
namespace KWin
{
BlurEffectConfig::BlurEffectConfig(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
ui.setupUi(this);
QString tooltipText = "Add window class values here, separated by semicolons.\n\nThe window class for a specific window can be found by either:\n1. Reading the value of WM_CLASS(STRING) from xprop.\n2. Opening 'Window Rules' -> 'Add New...' -> 'Detect Window Properties'\nand reading the 'Window class (application)' row.";
ui.kcfg_IncludedWindows->setToolTip(tooltipText);
// Setting up the file dialog.
m_dialog = new QFileDialog(this);
m_dialog->setFileMode(QFileDialog::ExistingFile);
m_dialog->setNameFilter("SVG files (*.svg)");
connect(ui.browse_pushButton, SIGNAL(clicked()), this, SLOT(setTexturePath()));
connect(ui.clear_pushButton, SIGNAL(clicked()), this, SLOT(clearTexturePath()));
// Initializing the KCModule parts.
BlurConfig::instance("kwinrc");
addConfig(BlurConfig::self(), this);
load();
}
void BlurEffectConfig::clearTexturePath()
{
ui.kcfg_TextureLocation->setText("");
}
void BlurEffectConfig::setTexturePath()
{
if(m_dialog->exec())
{
ui.kcfg_TextureLocation->setText(m_dialog->selectedFiles()[0]);
}
}
BlurEffectConfig::~BlurEffectConfig()
{
delete m_dialog;
}
// Saves the configuration to disk and calls the reconfigure function through qdbus.
void BlurEffectConfig::save()
{
KCModule::save();
OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"),
QStringLiteral("/Effects"),
QDBusConnection::sessionBus());
interface.reconfigureEffect(QStringLiteral("customblur"));
}
} // namespace KWin
#include "blur_config.moc"

View file

@ -0,0 +1,89 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kwin_blur2_config
X-KDE-ParentComponents=kwin4_effect_blur_forked
Name=Blur - respect rounded corners
Name[af]=Blur
Name[ar]=غشاوة
Name[az]=Yayğınlıq
Name[be]=Blur
Name[bg]=Замъгляване
Name[bn]=
Name[bn_IN]=Blur ()
Name[bs]=Zamućenje
Name[ca]=Difuminat
Name[ca@valencia]=Difumina
Name[cs]=Rozostření
Name[csb]=Rozmazóné
Name[da]=Slør
Name[de]=Verwischen
Name[el]=Θόλωμα
Name[en_GB]=Blur
Name[eo]=Malklarigi
Name[es]=Desenfocar
Name[et]=Hägu
Name[eu]=Lausotu
Name[fa]=محو
Name[fi]=Sumennus
Name[fr]=Flou - respecte les coins arrondis
Name[fy]=Ferfagje
Name[ga]=Blur
Name[gl]=Desenfocar
Name[gu]=
Name[he]=טשטוש
Name[hi]=
Name[hne]=
Name[hr]=Mrlja
Name[hsb]=Młowojty
Name[hu]=Elmosódás
Name[ia]=Obscura (Blur)
Name[id]=Buram
Name[is]=Móða
Name[it]=Sfocatura
Name[ja]=
Name[kk]=Бұлдыр
Name[km]=
Name[kn]=ಿ ()
Name[ko]=
Name[ku]=Blur
Name[lt]=Suliejimas
Name[lv]=Aizmiglot
Name[mai]=
Name[mk]=Заматување
Name[ml]=ി
Name[mr]=
Name[nb]=Slør
Name[nds]=Verwischen
Name[ne]=
Name[nl]=Vervagen
Name[nn]=Uklar
Name[pa]=
Name[pl]=Rozmycie
Name[pt]=BlueFish
Name[pt_BR]=Borrar
Name[ro]=Estompare
Name[ru]=Размытие
Name[se]=Seagas
Name[si]=
Name[sk]=Rozmazať
Name[sl]=Zabriši
Name[sr]=Замућење
Name[sr@ijekavian]=Замућење
Name[sr@ijekavianlatin]=Zamućenje
Name[sr@latin]=Zamućenje
Name[sv]=Oskärpa
Name[ta]=
Name[te]=
Name[th]=
Name[tr]=Bulanıklaştırma
Name[ug]=گۇڭگا
Name[uk]=Розмивання
Name[vi]=M
Name[wa]=Flou
Name[x-test]=xxBlurxx
Name[zh_CN]=
Name[zh_TW]=

View file

@ -0,0 +1,43 @@
/*
SPDX-FileCopyrightText: 2010 Fredrik Höglund <fredrik@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef BLUR_CONFIG_H
#define BLUR_CONFIG_H
#include <QFileDialog>
#include <KCModule>
#include "ui_blur_config.h"
#include <QSharedMemory>
#include <QBuffer>
#include <QDataStream>
#include <QColor>
#include <QPair>
namespace KWin
{
class BlurEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit BlurEffectConfig(QWidget *parent = nullptr, const QVariantList& args = QVariantList());
~BlurEffectConfig() override;
void save() override;
public slots:
void setTexturePath();
void clearTexturePath();
private:
::Ui::BlurEffectConfig ui;
QFileDialog* m_dialog;
};
} // namespace KWin
#endif

View file

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlurEffectConfig</class>
<widget class="QWidget" name="BlurEffectConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>456</width>
<height>250</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>444</width>
<height>250</height>
</size>
</property>
<property name="baseSize">
<size>
<width>444</width>
<height>450</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="labelConstantBlurDescription">
<property name="text">
<string>General:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelConstantNoiseDescription">
<property name="text">
<string>Blur region mask:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="kcfg_TextureLocation">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="browse_pushButton">
<property name="toolTip">
<string>Browse...</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="document-open"/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clear_pushButton">
<property name="toolTip">
<string>Clear</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-delete"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Enable this effect for the following Firefox-based browsers:</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="kcfg_IncludedWindows">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

20
KWin/kwin_fixblur/src/main.cpp Executable file
View file

@ -0,0 +1,20 @@
/*
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "blur.h"
//#include <kwineffects/effect_plugin_factory.h>
namespace KWin
{
KWIN_EFFECT_FACTORY_SUPPORTED_ENABLED(BlurEffect,
"metadata.json",
return BlurEffect::supported();
, return BlurEffect::enabledByDefault();)
} // namespace KWin
#include "main.moc"

View file

@ -0,0 +1,23 @@
{
"KPlugin": {
"Authors": [
{
"Email": "wackyideas@disroot.org",
"Name": "WackyIdeas"
}
],
"Category": "Appearance",
"Description": "Allows setting blur with custom blur regions to Firefox-based browsers.",
"EnabledByDefault": true,
"Id": "customblur",
"License": "AGPLv3",
"Name": "Firefox Blur Region Fix",
"ServiceTypes": [
"KWin/Effect"
]
},
"X-KDE-ConfigModule": "kwin4_effect_customblur_config",
"org.kde.kwin.effect": {
"enabledByDefaultMethod": true
}
}

5
KWin/kwin_fixblur/uninstall.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
cd build
sudo make uninstall && echo "Uninstalled successfully!"
cd ..
rm -rf build

View file

@ -227,6 +227,14 @@ function install {
cd "${INNER_KWIN}kwin_reflect" cd "${INNER_KWIN}kwin_reflect"
chmod +x "$script" && "$script" chmod +x "$script" && "$script"
cd "$rootdir" cd "$rootdir"
echo "Installing Firefox Blur Region Fix effect..."
local rootdir=$PWD
local script=./install.sh
cd "${INNER_KWIN}kwin_fixblur"
chmod +x "$script" && "$script"
cd "$rootdir"
#sudo mkdir -p "${KWIN_EFFECTS_DIR}" #sudo mkdir -p "${KWIN_EFFECTS_DIR}"
#sudo mkdir -p "${KWIN_CONFIGS_DIR}" #sudo mkdir -p "${KWIN_CONFIGS_DIR}"
#sudo cp "${INNER_KWIN}kwin_reflect/bin/${KWIN_EFFECT}" "${KWIN_EFFECTS_DIR}" #sudo cp "${INNER_KWIN}kwin_reflect/bin/${KWIN_EFFECT}" "${KWIN_EFFECTS_DIR}"