natask / kwin-effect-smart-invert

smart invert effect for kde.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kwin effect smart invert

Intelligently inverts windows by applying a shader that preserves colors other than black and white By Default. Exactly like the default invert plugin provided by KDE except it allows custom shaders.

Custom shaders

Shader files can be set in /usr/share/kwin/shaders/1.40. The file with name invert.frag will be selected. Turning the plugin off then back on within KWin effects will apply the new shader. Application comes with a few well selected shaders. The default being data/1.40/invert.frag.log69.cpp since it looks the best.

Default Shortcuts

Inverting the entire screen

SHIFT + CTRL + META + Z

Inverting the current window

CTRL + META + Z

You can change the shortcuts via System Settings -> Global Keyboard Shortcuts -> KWin Or directly from the kwin effects settings menu.

Features

  • Newly Created [2021-09-26 Sun 00:33:31]
Hot Swap
  • change shader file by following Custom shaders
  • invert a window to try out shader without affecting all windows.
  • invert the entire screen to apply new shader to all windows.
Block list
  • window classes added to blocklist in kde system settings effect configuration are not inverted.
  • Use `xprop WM_CLASS` or `wmctrl -lx` and take the second string to get window class. For example xprop WM_ClASS returns =M_CLASS(STRING) = “systemsettings5”, “systemsettings”= for a system settings window. Take the second string, =”systemsettings”= and place in blocklist.
  • Case insensitive.
  • If class has space, insert it with its spaces verbatum. E.g: first class,second,name with space,last
  • Separate window classes with comma. E.g: =discord,code - insider,emacs,=.

Dependencies

I haven’t tested these dependencies. refer to this and this repos.

Arch based
sudo pacman -S extra-cmake-modules kwin kf5
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 
Fedora based
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 kf5-knotifications-devel kf5-kinit-devel kwin-devel qt5-qtbase-devel libepoxy-devel

Building

git clone https://github.com/natask/kwin-effect-smart-invert.git
cd kwin-effect-smart-invert
mkdir -p build && cd build
cmake .. && make && sudo make install && (kwin_x11 --replace &)

inspirations

Plugin
Shaders

TODOs

Window pass lists.

  • State “TODO” from [2021-10-21 Thu 10:57:31 PDT]
  • Newly Created [2021-10-21 Thu 10:57:19 PDT]

What is the point of duplicated declarations for keybindings in invert.cpp and invert_config.cpp.

Auto Start inverted

  • State “DONE” from “NEXT” [2021-09-25 Sat 20:53:42]

Change internal naming from kwin-effect-smartInvert to kwin-effect-smart-invert

  • State “DONE” from “NEXT” [2021-09-25 Sat 20:54:16]

Hot swap shader files.

  • State “DONE” from “NEXT” [2021-09-25 Sat 21:00:30]

Window block lists.

  • State “DONE” from “NEXT” [2021-10-21 Thu 10:57:17 PDT]

User level plugins

  • State “DONE” from “NEXT” [2021-10-21 Thu 10:57:45 PDT]
I beleve I have already implemented this. It required modifying CMakeList.txt.

About

smart invert effect for kde.


Languages

Language:C++ 72.7%Language:CMake 22.4%Language:GLSL 4.9%