Skip to content

Commit

Permalink
Version 2.2: backport new features from plasma6 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
a-parhom committed Jan 25, 2024
1 parent 30bd175 commit 224f35f
Show file tree
Hide file tree
Showing 69 changed files with 9,183 additions and 2,116 deletions.
76 changes: 16 additions & 60 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
cmake_minimum_required(VERSION 3.16.0)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(LIGHTLYSHADERS kwin4_effect_lightlyshaders)

project(${LIGHTLYSHADERS})
set(PROJECT_VERSION "2.2.0")
set(PROJECT_VERSION_MAJOR 0)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose Release or Debug" FORCE)
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG_OUTPUT")

set(QT_MIN_VERSION "5.4.0")
set(KF5_MIN_VERSION "5.9.0")
set(QT_MIN_VERSION "5.15.2")
set(KF5_MIN_VERSION "5.102.0")

find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
Expand All @@ -27,6 +35,7 @@ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
include_directories(${Qt5Widgets_INCLUDE_DIRS} ${Qt5X11Extras_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS})
add_definitions(${Qt5Widgets_DEFINITIONS})

include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
Expand Down Expand Up @@ -83,65 +92,12 @@ if (NOT EFFECTS_H OR NOT KWIN_GLUTILS OR NOT KWIN_EFFECTS OR NOT OPENGL)
message(FATAL_ERROR "cant continue")
endif (NOT EFFECTS_H OR NOT KWIN_GLUTILS OR NOT KWIN_EFFECTS OR NOT OPENGL)

add_library(${LIGHTLYSHADERS} MODULE lightlyshaders.cpp)

target_link_libraries(${LIGHTLYSHADERS}
PUBLIC
Qt5::Core
Qt5::Gui
Qt5::DBus
${KWIN_EFFECTS}
${KWIN_GLUTILS}
epoxy
GL
PRIVATE
KF5::ConfigCore
KF5::CoreAddons
KF5::ConfigWidgets
KF5::GuiAddons
KF5::WindowSystem
KDecoration2::KDecoration
)

if (XCB_FOUND)
target_link_libraries(${LIGHTLYSHADERS} PUBLIC Qt5::X11Extras XCB::XCB)
else (XCB_FOUND)
if (X11_FOUND)
target_link_libraries(${LIGHTLYSHADERS} PUBLIC ${X11_X11_LIB} ${X11_LIBRARIES})
endif (X11_FOUND)
endif (XCB_FOUND)

#kcoreaddons_desktop_to_json(${LIGHTLYSHADERS} lightlyshaders.desktop)

install(TARGETS ${LIGHTLYSHADERS} DESTINATION ${MODULEPATH}/kwin/effects/plugins)
# execute_process(COMMAND kf5-config --install services OUTPUT_VARIABLE SERVICEPATH OUTPUT_STRIP_TRAILING_WHITESPACE)
#install(FILES lightlyshaders.desktop DESTINATION ${SERVICEPATH}/kwin)

execute_process(COMMAND kf5-config --install data OUTPUT_VARIABLE DATAPATH OUTPUT_STRIP_TRAILING_WHITESPACE)

install(FILES shaders_110/lightlyshaders.frag DESTINATION ${DATAPATH}/kwin/shaders/1.10)
install(FILES shaders_140/lightlyshaders.frag DESTINATION ${DATAPATH}/kwin/shaders/1.40)

#config
function(kwin_add_effect_config name)
list(REMOVE_ITEM ARGV ${name})
kcoreaddons_add_plugin(${name} INSTALL_NAMESPACE "kwin/effects/configs" SOURCES ${ARGV})
endfunction()

project(kwin4_lightlyshaders_config)
set(kwin4_lightlyshaders_config_SOURCES lightlyshaders_config.cpp)
ki18n_wrap_ui(kwin4_lightlyshaders_config_SOURCES lightlyshaders_config.ui)
qt5_add_dbus_interface(kwin4_lightlyshaders_config_SOURCES org.kde.kwin.Effects.xml kwineffects_interface)
kwin_add_effect_config(kwin4_lightlyshaders_config ${kwin4_lightlyshaders_config_SOURCES})
target_link_libraries(kwin4_lightlyshaders_config
PUBLIC
kwineffects
Qt5::Widgets
PRIVATE
KF5::ConfigWidgets
KF5::WindowSystem
KF5::I18n
KF5::GlobalAccel
)
add_subdirectory(src)

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,35 @@
- [Ukrainian army](https://bank.gov.ua/en/about/support-the-armed-forces)
- [Humanitarian aid to Ukraine](https://bank.gov.ua/en/about/humanitarian-aid-to-ukraine)

# LightlyShaders v2.1
# LightlyShaders v2.2
This is a fork of Luwx's [LightlyShaders](https://github.com/Luwx/LightlyShaders), which in turn is a fork of [ShapeCorners](https://sourceforge.net/projects/shapecorners/).

It works correctly with stock Plasma effects:
It works correctly with stock Plasma effects.

![gif](https://github.com/a-parhom/LightlyShaders/blob/v2.0/lightly_shaders_2.0.gif)
![default](https://github.com/a-parhom/LightlyShaders/blob/master/screenshot.png)

![default](https://github.com/a-parhom/LightlyShaders/blob/v2.0/screenshot.png)
# Changelog:
- Includes a fork of KWin Blur effect to fix the "korner bug" on X11 and Wayland
- The settings for outline width and color were added
- Works with any window decorations
- Shadow offset parameter can solve issues with window decorations outlines
- Window shaping does not use additional textures and is done entirely in shader, which potentially improves performance

# Plasma 6:
On Plasma 6 Beta and RC builds you can try experimental branch **plasma6**. Eventually it will become the main branch.

On Plasma 6 beta builds you can try experimental branch **plasma6**. It includes a fork of KWin Blur effect to fix the "korner bug" and does not need any specific window decorations. The settings for outline width and color were added. Eventually it will become the main branch and the RoundedSBE repo will be archived.

# Warning:

## On Wayland corners may have "korner bug" when using blur due to the lack of [API for adjusting blur region](https://invent.kde.org/plasma/kwin/-/merge_requests/3407) on Plasma 5.27.

## This version heavily relies on window decorations, that correctly work with Plasma 5.25 "korner bug" fix!
Currently I can confirm this effect correctly works with **SierraBreezeEnhanced** or default **Breeze** (though Breeze has hardcoded corner radius). You have to make sure, that your radius settings in window decorations match with settings in LightlyShaders.

## Alternatively you can try my new project: [RoundedSBE](https://github.com/a-parhom/RoundedSBE)
This is a fork of **SierraBreezeEnhanced** window decoration with a built-in corner-rounding effect **CornersShader** - a simplified version of LightlyShaders, integrated with RoundedSBE's configuration. It is in it's early stage, may have bugs and/or missing features.

# Notes:
- After some updates of Plasma this plugin may need to be recompiled in order to work with changes introduced to KWin.
- This version includes a patched KWin Blur effect, that shapes blur region using the lshelper library that also comes bundled with this plugin. To build it in Plasma 5.27.10, some KWin headers were included and an installer script introduced, which makes a symlink to libkwin.so.5. This is needed, because KWin development packages for Plasma 5.27 does not include that (which is not the case in Plasma 6).
- You will need to install qt5, kf5, kwin and xcb development packages. Instructions below come mostly from previous version and most likely do not include each required package. Unfortunately, I'm not able to figure out the dependency packages for each linux distro, so pull requests are welcome here.

# Dependencies:

Plasma >= 5.27 (5.27.1 to fix issue #87).
Plasma >= 5.27.10.

Debian based (Ubuntu, Kubuntu, KDE Neon):
```
sudo apt install git cmake g++ gettext extra-cmake-modules qttools5-dev libqt5x11extras5-dev libkf5configwidgets-dev libkf5crash-dev libkf5globalaccel-dev libkf5kio-dev libkf5notifications-dev kinit-dev kwin-dev
sudo apt install git cmake g++ gettext extra-cmake-modules qttools5-dev libqt5x11extras5-dev libkf5*-dev libxcb*-dev kinit-dev kwin-dev
```
Fedora based
```
Expand All @@ -50,15 +48,18 @@ OpenSUSE based
sudo zypper install git cmake gcc-c++ extra-cmake-modules libqt5-qttools-devel libqt5-qtx11extras-devel kconfigwidgets-devel kcrash-devel kguiaddons-devel kglobalaccel-devel kio-devel ki18n-devel knotifications-devel kinit-devel kwin5-devel libQt5Gui-devel libQt5OpenGL-devel libepoxy-devel
```

# Manual installation
# Installation
```
git clone https://github.com/a-parhom/LightlyShaders
cd LightlyShaders;
mkdir qt5build; cd qt5build; cmake ../ -DCMAKE_INSTALL_PREFIX=/usr && make && sudo make install && (kwin_x11 --replace &)
chmod +x install.sh
sudo ./install.sh
```

## Note
After some updates of Plasma this plugin may need to be recompiled in order to work with changes introduced to KWin.

# Uninstall
```
chmod +x uninstall.sh
sudo ./uninstall.sh
```
26 changes: 26 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

LIBKWIN_PATH=$(locate libkwin.so.5 | grep '\/libkwin.so.5$')
LIBKWIN_DIR="$(dirname "${LIBKWIN_PATH}")"

if [ ! -f "$LIBKWIN_PATH" ]; then
echo "libkwin.so.5 library not found, exiting..."
exit 1
fi

if [ ! -f "$LIBKWIN_DIR/libkwin.so" ]; then
echo "Creating libkwin.so symlink..."
sudo ln -s "$LIBKWIN_PATH" "$LIBKWIN_DIR/libkwin.so"
fi

ORIGINAL_DIR=$(pwd)

rm -rf build
mkdir build
cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=/usr
make -j$(nproc)
sudo make install

cd $ORIGINAL_DIR
Binary file removed lightly_shaders_2.0.gif
Binary file not shown.
Loading

0 comments on commit 224f35f

Please sign in to comment.