KDE workspace change hook

Hello guys
I m using opensuse 13.2 with KDE with four workspaces. As I use Konsole and Sublime text with dark theme in first workspace and chromium and other bright applications in second workspace.
As dark windows need back-light to be bigger, I have to manually change back-light whenever I change workspace.
On the other hand i can use

xbacklight -set 40 


xgamma -gamma .9

to adjust it. So I was wondering whether there is a hook to trigger with workspace change, so that back-light will be 100% in workspace 1 and 40% in workspace 2.

Probably not the most efficient way but…

In my system:

:~> wmctrl -d
0  - DG: 3840x1200  VP: 0,0  WA: 0,0 3791x1134  Desktop 1
1  - DG: 3840x1200  VP: 0,0  WA: 0,0 3791x1134  Desktop 2
2  - DG: 3840x1200  VP: 0,0  WA: 0,0 3791x1134  Desktop 3
3  * DG: 3840x1200  VP: 0,0  WA: 0,0 3791x1134  Desktop 4

Part of man wmctrl:

 -d     List all desktops managed by the window manager. One line is output for each desktop, with the line broken up into  space
              separated  columns.  The  first column contains an integer desktop number. The second column contains a '*' character for
              the current desktop, otherwise it contains a '-' character. The next two columns contain the fixed string  DG:  and  then
              the desktop geometry as '<width>x<height>' (e.g. '1280x1024'). The following two columns contain the fixed string VP: and
              then the viewport position in the format '<y>,<y>' (e.g. '0,0'). The next three columns after  this  contains  the  fixed
              string  WA:  and then two columns with the workarea geometry as 'X,Y and WxH' (e.g. '0,0 1280x998'). The rest of the line
              contains the name of the desktop (possibly containing multiple spaces).

It’s in the OSS repo:

sudo zypper install wmctrl

This can probably be done via a KWin script.
See https://techbase.kde.org/Development/Tutorials/KWin/Scripting

KWin does offer a desktopChanged() signal:
PS: A “desktopchangeOSD” script is preinstalled, maybe you can adapt this to your needs.
It’s in /usr/share/kde4/apps/kwin/scripts/desktopchangeosd/.

Thanks for all answers.
Brunomcl, wmctrl does not have features I want.
Wolfi23, kwin is awesome I did some coding and I am working on it.