Skip to content

Commit

Permalink
Merge branch 'master' into tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
matinlotfali committed Jan 24, 2024
2 parents 2b2ac62 + d97831c commit 8169528
Show file tree
Hide file tree
Showing 32 changed files with 1,015 additions and 545 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
custom: https://www.paypal.com/donate/?business=WYGJ6T4J23P2L&no_recurring=0&currency_code=CAD
github: USERNAME
4 changes: 2 additions & 2 deletions .github/workflows/arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:

steps:
- name: Refresh Packages
run: yes | pacman -Syu
run: pacman -Syu --noconfirm

- name: Install Dependencies
run: yes | pacman -S git cmake extra-cmake-modules qt5-tools kwin wireplumber
run: pacman -S --noconfirm git cmake extra-cmake-modules qt5-tools kwin wireplumber

- name: Check out repository
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/debian12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
continue-on-error: true

- name: Install Dependencies
run: apt -y install cmake g++ gettext extra-cmake-modules qttools5-dev libqt5x11extras5-dev libkf5configwidgets-dev libkf5globalaccel-dev libkf5notifications-dev kwin-dev
run: apt -y install cmake g++ gettext extra-cmake-modules qttools5-dev libkf5configwidgets-dev kwin-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/glslangValidator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
run: sudo apt update && sudo apt install -y glslang-tools

- name: Validate Shaders
run: glslangValidator src/shaders_110/shapecorners.frag src/shaders_140/shapecorners.frag
run: glslangValidator src/shaders/shapecorners.frag src/shaders/shapecorners_core.frag
2 changes: 1 addition & 1 deletion .github/workflows/kubuntu2204-backports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: sudo add-apt-repository -y ppa:kubuntu-ppa/backports-extra

- name: Install Dependencies
run: sudo apt install -y gettext extra-cmake-modules qttools5-dev libqt5x11extras5-dev libkf5configwidgets-dev libkf5globalaccel-dev libkf5notifications-dev kwin-dev
run: sudo apt install -y gettext extra-cmake-modules qttools5-dev libkf5configwidgets-dev kwin-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/neon-unstable.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
name: KDE Neon (Unstable)

on:
workflow_dispatch:
push:
branches: [ master ]
paths-ignore: [ '**.md', '**.png' ]
pull_request:
branches: [ master ]
paths-ignore: [ '**.md', '**.png' ]
schedule:
- cron: "0 0 * * *"

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand All @@ -23,11 +30,19 @@ jobs:
uses: actions/checkout@v3

- name: Refresh KDE Neon Packages
run: apt update && apt -y dist-upgrade
run: apt update && apt -y --allow-downgrades dist-upgrade
continue-on-error: true

- name: Second refresh KDE Neon Packages
run: apt update && apt -y --allow-downgrades dist-upgrade
continue-on-error: true

- name: Third refresh KDE Neon Packages
run: apt update && apt -y --allow-downgrades autoremove
continue-on-error: true

- name: Install Dependencies
run: apt -y install cmake g++ gettext extra-cmake-modules qttools5-dev libqt5x11extras5-dev libkf5configwidgets-dev libkf5globalaccel-dev libkf5notifications-dev kwin-dev
run: apt -y install cmake g++ gettext extra-cmake-modules qt6-base-dev-tools kf6-kcmutils-dev kwin-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/neon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
continue-on-error: true

- name: Install Dependencies
run: apt -y install cmake g++ gettext extra-cmake-modules qttools5-dev libqt5x11extras5-dev libkf5configwidgets-dev libkf5globalaccel-dev libkf5notifications-dev kwin-dev
run: apt -y install cmake g++ gettext extra-cmake-modules qttools5-dev libkf5configwidgets-dev kwin-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/cmake-build-*/
/qt5build/
/build/
/Testing/
CMakeLists.txt.user
67 changes: 40 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.20)

project(kwin-effects-yaml)
project(kwin4_effect_shapecorners)

set(KF_MIN_VERSION "5.78")
set(QT_MIN_VERSION "5.15")
set(QT_MAJOR_VERSION 5)

set(KF5_MIN_VERSION "5.78")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand All @@ -12,53 +15,63 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG_OUTPUT")

find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${ECM_MODULE_PATH}
${ECM_KDE_MODULE_DIR}
)

find_package(Qt5 CONFIG REQUIRED COMPONENTS
Gui
Core
DBus
UiTools
Widgets
X11Extras
OpenGL
Network
Xml
)
if(ECM_VERSION VERSION_GREATER "5.200.0")
set(QT_MIN_VERSION "6.4.0")
set(QT_MAJOR_VERSION 6)
endif()

include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)

# required frameworks by Core
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Config
find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS
ConfigWidgets
CoreAddons
GlobalAccel
WindowSystem
)
if(${QT_MAJOR_VERSION} EQUAL 6)
find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS
KCMUtils
)

find_package(KWin REQUIRED COMPONENTS
kwineffects
)
set(KWIN_EFFECT_INCLUDE_FILE "/usr/include/kwin/effect/effect.h")
else()
find_package(KWinEffects REQUIRED COMPONENTS
kwineffects
kwinglutils
)
set(KWIN_EFFECT_INCLUDE_FILE "/usr/include/kwineffects.h")
endif ()

find_package(epoxy REQUIRED)
find_package(XCB REQUIRED COMPONENTS XCB)

find_package(KWinEffects REQUIRED COMPONENTS
kwineffects
kwinglutils
)

find_package(KWinDBusInterface CONFIG REQUIRED)
find_package(epoxy REQUIRED)

add_subdirectory(src)

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)

execute_process(
COMMAND sh -c "grep '#define KWIN_EFFECT_API_VERSION_MINOR' ${KWIN_EFFECT_INCLUDE_FILE} | awk '{print \$NF}'"
OUTPUT_VARIABLE KWIN_EFFECT_API_VERSION_MINOR OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("KWinEffect API Version: ${KWIN_EFFECT_API_VERSION_MINOR}")
message("")

add_test (NAME KWinEffectSupport COMMAND sh ${CMAKE_CURRENT_LIST_DIR}/tools/isSupported.sh)
set_property (TEST KWinEffectSupport PROPERTY PASS_REGULAR_EXPRESSION "true")


# these are cache variables, so they could be overwritten with -D,
set(CPACK_PACKAGE_NAME kwin4-effect-shapecorners
CACHE STRING kwin4-effect-shapecorners
Expand Down
141 changes: 105 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,66 @@ This effect rounds the corners of your windows and adds an outline around them w

This effect started as a fork of [shapecorners](https://sourceforge.net/projects/shapecorners/) with some additional contributions in [Alex47's project](https://github.com/alex47/KDE-Rounded-Corners), then I optimized and reimplemented the effect with shaders with influences from the [invert effect](https://github.com/KDE/kwin/tree/master/src/plugins/invert).

#### Tested on:
**Tested on:**
- ![Wayland](https://img.shields.io/badge/Wayland-supported-green?logo=wayland) ![Wayland](https://img.shields.io/badge/X11-supported-green?logo=X.org)
- ![Kubuntu 22.04 Jammy](https://img.shields.io/badge/-not_supported-red?label=Kubuntu%2022.04%20Jammy&logo=kubuntu&branch=master)
![](https://img.shields.io/badge/KWinEffects-v233-lightgrey)
- ![Kubuntu 22.04 Jammy + Backports](https://img.shields.io/github/actions/workflow/status/matinlotfali/KDE-Rounded-Corners/kubuntu2204-backports.yml?label=Kubuntu%2022.04%20Jammy%20+%20Backports&logo=kubuntu&branch=master)
![](https://img.shields.io/badge/KWinEffects-v234-lightgrey)
![](https://img.shields.io/badge/KWinEffects-v233-red) ![](https://img.shields.io/badge/Plasma-5.24-red)
- ![Kubuntu 22.04 Jammy + Backports](https://img.shields.io/github/actions/workflow/status/matinlotfali/KDE-Rounded-Corners/kubuntu2204-backports.yml?label=Kubuntu%2022.04%20Jammy%20%2b%20Backports&logo=kubuntu&branch=master)
![](https://img.shields.io/badge/KWinEffects-v236-lightgrey) ![](https://img.shields.io/badge/Plasma-5.27-lightgrey)
- ![Debian 12 Bookworm](https://img.shields.io/github/actions/workflow/status/matinlotfali/KDE-Rounded-Corners/debian12.yml?branch=master&label=Debian%2012%20Bookworm&logo=debian)
![](https://img.shields.io/badge/KWinEffects-v236-lightgrey)
- ![KDE Neon (Stable)](https://img.shields.io/github/actions/workflow/status/matinlotfali/KDE-Rounded-Corners/neon.yml?branch=master&label=KDE%20Neon%20%28Stable%29&logo=kde&logoColor=white)
![](https://img.shields.io/badge/KWinEffects-v236-lightgrey)
![](https://img.shields.io/badge/KWinEffects-v236-lightgrey) ![](https://img.shields.io/badge/Plasma-5.27-lightgrey)
- ![KDE Neon (Stable)](https://img.shields.io/github/actions/workflow/status/matinlotfali/KDE-Rounded-Corners/neon.yml?branch=master&label=KDE%20Neon%20%28Stable%29&logo=kde&logoColor=white)
![](https://img.shields.io/badge/KWinEffects-v236-lightgrey) ![](https://img.shields.io/badge/Plasma-5.27-lightgrey)
- ![KDE Neon (Unstable)](https://img.shields.io/github/actions/workflow/status/matinlotfali/KDE-Rounded-Corners/neon-unstable.yml?branch=master&label=KDE%20Neon%20%28Unstable%29&logo=kde&logoColor=white)
![](https://img.shields.io/badge/KWinEffects-v237-lightgrey)
![](https://img.shields.io/badge/KWinEffects-v237-lightgrey) ![](https://img.shields.io/badge/Plasma-6.0-lightgrey)
- [![Arch](https://img.shields.io/github/actions/workflow/status/matinlotfali/KDE-Rounded-Corners/arch.yml?branch=master&label=Arch%20Linux&logo=archlinux&logoColor=white) ![](https://img.shields.io/aur/maintainer/kwin-effect-rounded-corners-git?label=AUR%20Maintainer) ![](https://img.shields.io/aur/votes/kwin-effect-rounded-corners-git?label=AUR%20Votes)](https://aur.archlinux.org/packages/kwin-effect-rounded-corners-git)

![After](screenshots/decoration-color.png)
![After](screenshots/shadows2.png)

# Contributions:

- Compatibility of the effect with other effects like Wobbly windows - by [matinlotfali](https://github.com/matinlotfali)
- Optimize the effect to render once instead of 5 times - by [matinlotfali](https://github.com/matinlotfali) - see [#49](https://github.com/matinlotfali/KDE-Rounded-Corners/pull/49)
- Reimplementation with shaders to include shadows at corners and an outline - by [matinlotfali](https://github.com/matinlotfali)
- Compatibility with KWin from versions 5.23 to 5.27 - by [matinlotfali](https://github.com/matinlotfali)
- Disable effect when window gets maximized - by [matinlotfali](https://github.com/matinlotfali)
- Compatibility of the effect with other effects like Wobbly windows
- Compatibility with KWin for Plasma versions 5.27 to 6.0
- Optimize the effect to render once instead of 5 times - see [#49](https://github.com/matinlotfali/KDE-Rounded-Corners/pull/49)
- Reimplementation with shaders to include shadows at corners and an outline
- Disable effect when windows get maximized
- Cleanups for the plugin logic, remove unneeded dependencies from CMakeLists.txt file - by [alex1701c](https://github.com/alex1701c)
- Separate outline color for active and inactive windows - by [OrkenWhite](https://github.com/OrkenWhite)
- Add natural shadows using parametric blend - by [paletteOvO](https://github.com/paletteOvO)

# How to build from source code:

You need to install development packages for your distribution first:

- **Debian based (Ubuntu, Kubuntu, KDE Neon)** - by [alex47](https://github.com/alex47):
```
sudo apt install git cmake g++ gettext extra-cmake-modules qttools5-dev libqt5x11extras5-dev libkf5configwidgets-dev libkf5globalaccel-dev libkf5notifications-dev kwin-dev
```
- **Fedora** - by [matinlotfali](https://github.com/matinlotfali)
```
sudo dnf install git cmake gcc-c++ extra-cmake-modules qt5-qttools-devel qt5-qttools-static qt5-qtx11extras-devel kf5-kconfigwidgets-devel kf5-kcrash-devel kf5-kguiaddons-devel kf5-kglobalaccel-devel kf5-kio-devel kf5-ki18n-devel kwin-devel qt5-qtbase-devel libepoxy-devel
```
- **Arch** - by [hexa-one](https://github.com/hexa-one)
<details>
<summary>Debian based (Ubuntu, Kubuntu, KDE Neon)</summary>
<br>

- Plasma 5 - by [alex47](https://github.com/alex47):
```
sudo apt install git cmake g++ extra-cmake-modules kwin-dev libkf5configwidgets-dev
```
- Plasma 6
```
sudo apt install git cmake g++ extra-cmake-modules kwin-dev qt6-base-dev-tools kf6-kcmutils-dev
```
</details>
<details>
<summary>Fedora</summary>
<br>
- Plasma 5 (Fedora 39)
```bash
sudo dnf install git cmake gcc-c++ extra-cmake-modules kwin-devel kf5-kconfigwidgets-devel libepoxy-devel
```
- Plasma 6 (Fedora 40 and later)
```bash
sudo dnf install git cmake gcc-c++ extra-cmake-modules kwin-devel kf6-kconfigwidgets-devel libepoxy-devel kf6-kcmutils-devel qt6-qtbase-private-devel wayland-devel
```
</details>
<details>
<summary>Arch - by https://github.com/hexa-one</summary>

```
sudo pacman -S git cmake extra-cmake-modules base-devel
yay -S qt5-tools
Expand All @@ -50,22 +72,31 @@ You need to install development packages for your distribution first:
```
sudo pamac build kwin-effect-rounded-corners-git
```
- **OpenSUSE** - by [mathiasgredal](https://github.com/mathiasgredal) and [Richardsause](https://github.com/Richardsause)
</details>
<details>
<summary>OpenSUSE - by https://github.com/mathiasgredal and https://github.com/Richardsause</summary>

```
sudo zypper install git cmake gcc-c++ extra-cmake-modules libqt5-qttools-devel libqt5-qtx11extras-devel kconfigwidgets-devel kguiaddons-devel kglobalaccel-devel ki18n-devel knotifications-devel kwin5-devel libQt5Gui-devel libQt5OpenGL-devel libepoxy-devel kwindowsystem-devel libqt5-qtnetworkauth-devel
sudo zypper install git cmake gcc-c++ extra-cmake-modules libqt5-qttools-devel kconfigwidgets-devel kguiaddons-devel ki18n-devel knotifications-devel kwin5-devel libQt5Gui-devel libQt5OpenGL-devel libepoxy-devel libqt5-qtnetworkauth-devel
```
- **Void** - by [lay-by](https://github.com/lay-by)
</details>
<details>
<summary>Void - by https://github.com/lay-by</summary>

```
xbps-install git cmake make qt5-tools-devel extra-cmake-modules qt5-x11extras-devel gettext-devel kwin-devel
xbps-install git cmake make qt5-tools-devel extra-cmake-modules gettext-devel kwin-devel
```
- **NixOS** - by [Pavel Zolotarevskiy](https://github.com/flexagoon)
</details>
<details>
<summary>NixOS - by https://github.com/flexagoon</summary>

```
nix-env -iA nixos.kde-rounded-corners
```
</details>

Then get the source code and compile:
```
Then clone the source code and compile it:
```bash
git clone https://github.com/matinlotfali/KDE-Rounded-Corners
cd KDE-Rounded-Corners
mkdir build
Expand All @@ -75,15 +106,53 @@ make
sudo make install
```

You can now logout and log back in or run the command below to have it activated.
# Load & Unload

To activate the effect, you can now log out and log back in, or run the command below inside the `build` directory:
```bash
sh ../tools/load.sh
```
kwin --replace &

To fully uninstall the effect, run the following commands inside the `build` directory:

```bash
sh ../tools/unload.sh
sudo make uninstall
```

# Auto install after KWin update

After each `kwin` package update, the effect becomes incompatible. So it won't load without a rebuild.

As long as the effect is not part of the `kwin` yet (being discussed
[here](https://invent.kde.org/plasma/kwin/-/issues/198)), you can automate the re-installation by running the command
below inside the `build` directory:

```bash
sh ../tools/autorun-test-install.sh
```

The command above adds a `desktop` file inside the `autorun` directory which checks if the effect is still supported,
if it is not supported, it would automatically rebuild and reinstall the effect.

# Settings

You can change corner radius, or disable the effect in:
You can change the corner radius, or disable the effect in:

> [ System Settings ] --> [ Workspace Behavior ] --> [ Desktop Effects ] --> [ ShapeCorners ]
# Tips

## Add shadow to windows without decoration (like Steam)

You can add shadows for specific windows using the hack below. I don't know how to enforce it in my code.

1. In [ System settings ] -> [ Window management ] -> [ Window rules ] -> [ Appearance & Fixes ]:

**Add [steam] and set [ No titlebar ] and frame to [ No ]**

3. In [ System settings ] -> [ Application Style ] -> [ Window decoration ] -> [ Breeze theme setting ] -> [ Window specific overrides ]:

> System Settings --> Workspace Behavior --> Desktop Effects --> ShapeCorners
**Add [steam] and set [ Hide Window title bar ] to [ Yes ].**

To fully uninstall, simply run the command `sudo make uninstall` inside `build` directory
After that, the Steam window gets its shadows back.
Binary file added screenshots/shadows2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8169528

Please sign in to comment.